본문 바로가기

Linux/Commands Part

mount

# Mounting File Systems
$ mount List mounted remote and local file systems
$ mount -t ext3 List mounted ext3 file systems
$ mount -t ext3 -l List mounted ext3 file systems and labels
# mount /dev/sda1 /mnt/mymount/ Mount a local file system
# mount -v /dev/sda1 /mnt/mymount/ Mount file system, more verbose
# mount -v -t ext3 /dev/sda1 /mnt/mymount/ Mount an ext3 file system
# mount -vl -t ext3 /dev/sda1 /mnt/mymount/ Mount file system/show label
# mount -v /dev/sda1 Mount file system with device name only
# mount -v /mnt/mymount/ Mount file system with mount point only
# mount -v -t ext3 -o rw /dev/sda1 /mnt/mymount/ Mount read/write

A few other useful mount options you can use include:
❑ noatime — Does not update the access time on files. Good on file systems with a
lot of I/O, such as mail spools and logs.
❑ noexec — Prevents execution of binaries located on this file system. Can be used
to increase security, for example for /tmp in environments with untrusted users.
❑ remount — Change options on a mounted file system. With remount, you can
unmount the file system and remount it with the new options in a single command.
In this example, we change a previous read/write mount to read-only:
# mount -v -o remount,ro /dev/sda1
/dev/sda1 on /mnt/mymount type ext3 (ro)
❑ --bind — Mount an existing file system to another location in the tree. Assuming
/dev/sda1 is already mounted on /mnt/mymount, type the following:

# mount --bind -v /mnt/mymount/ /tmp/mydir/
❑ --move — Move a file system from one mount point to another. Assuming
# mount -v --move /mnt/mymount/ /tmp/mydir/
# mount -v -t iso9660 -o loop /tmp/myimage.iso /mnt/mymount/
# mount -v -o loop /tmp/diskboot.img /mnt/mymount
# losetup -a List mounted loopback devices
# losetup -d /dev/loop1 Force unmount of a mounted loopback device