1. 程式人生 > >mount命令

mount命令

linux命令

磁盤進行掛載一定是一個目錄,這個目錄就是進入該磁盤分區的一個入口。

掛載命令mount,首先man mount查看技術文檔。

mount - mount a filesystem 掛載文件系統

The standard form of the mount command, is mount -t type -o options device dir(標準語法)

-t type表示:指定要掛載的文件系統類型,ext2/ext3/ext4/vfat/iso9660...

-o options表示:額外的參數,如ro/rw,async/sync,auto/noauto...

device表示:是一個文件的名稱或一個特殊的塊設備,比如/dev/sda1,也可能是一個特殊的NFS設備名稱可能是knuth.cwi.nl:/dir,這樣就需要使用它的LABEL或UUID進行自動0掛載。

dir表示:掛載的目錄


mount 的選項

[root@www ~]# mount -V 查看版本信息

mount from util-linux-ng 2.17.2 (with libblkid and selinux support)


[root@www ~]# mount -h 查看幫助信息

Usage: mount -V : print version

mount -h : print this help

mount : list mounted filesystems

mount -l : idem, including volume labels

So far the informational part. Next the mounting.

The command is `mount [-t fstype] something somewhere'.

Details found in /etc/fstab may be omitted.

mount -a [-t|-O] ... : mount all stuff from /etc/fstab

mount device : mount device at the known place

mount directory : mount known device here

mount -t type dev dir : ordinary mount command

Note that one does not really mount a device, one mounts

a filesystem (of the given type) found on the device.

One can also mount an already visible directory tree elsewhere:

mount --bind olddir newdir

or move a subtree:

mount --move olddir newdir

One can change the type of mount containing the directory dir:

mount --make-shared dir

mount --make-slave dir

mount --make-private dir

mount --make-unbindable dir

One can change the type of all the mounts in a mount subtree

containing the directory dir:

mount --make-rshared dir

mount --make-rslave dir

mount --make-rprivate dir

mount --make-runbindable dir

A device can be given by name, say /dev/hda1 or /dev/cdrom,

or by label, using -L label or by uuid, using -U uuid .

Other options: [-nfFrsvw] [-o options] [-p passwdfd].

For many more details, say man 8 mount .


[root@www ~]# mount -v 冗長格式,查看所有掛載的詳細信息

/dev/sda5 on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw)

/dev/sda1 on /boot type ext4 (rw)

/dev/sda2 on /usr type ext4 (rw)

/dev/sdc4 on /home type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)


L LABEL=指定label進行掛載

U UUID 指定UUID進行掛載


常用命令:

[root@www ~]# mount -a 依據/etc/fstab文件信息進行掛載所有


mount命令