Mount 编辑 请登陆,再编辑


Linux sees all resources, such as hardware, disk partitions, as file, and they need to be mounted to certain places before they can be operated.

In order to open a file on the device, users need first to mount the device to a directory, using command "mount". The root directory, however, need not to be operated manually, as it should remain mounted. It is worth noting that a file system does not need to be a hardware device, it can be a single file, too.

Mount point

Mount point is, in fact, the entry of any other file system or device within root file system.

Take disk as example. Every disk contains several partitions, and each partition has its own file system. As Linux uses tree structure to manage files, it is easy to understand that all file systems are mounted to certain nodes in the tree.

Like the drive "C:" in Windows, Linux has its own root file system "/". After the root file system is mounted, users can mount other file system to different nodes (mount point) within the root filesystem. It is also possible that one file system has several mount point at a same time.


Filesystem Hierarchy Standard is a document that defines layout of public directories in Linux and other Unix-like system. By restrain the places where common files are put, FHS simplify the development of software that is independent from evolution of Linux system. FHS is also used in Linux Standard Base (LSB). FHS allows users and softwares to predict the location of installation. A file system following FHS assumes that the opertaing system supports most of the basic security features from Unix file system.

The two indepedent caracters of file are the cord of FHS: the shareable and the unshareable. The shareable file can be located in one system, while usable to another system; the unshareable file, however, must be used in the same system where it is located.

Another two important characters of files are statics and variables. The former can only be changed by system administrator, such as by installing or updating packages, documents, libraries or binaries. The latter can be journals, databases and user data, which can be changed by user or system process. All these characters make ordered storage of different types of file in different places within the root file system.

FHS standard directory in root file system

The purporse of FHS is that the root file system is as small as possible. This, however, does not prevent it from including all necessary files for booting, recoverying, restoring and repairing of system, which are neede by experienced administrators. Note that there must also be enough free space in root file system for other file systems to be mounted.

Some commonly used directories of FHS are shown below. Both directories and their symbol links are necessary, except those marked with "optional", which are needed only when certain subsystem exists.

Description of FHS directory

  • / Root directory, must be mounted first. All other mount points are derived from root directory.

  • /bin Contains commands commonly used by users. Static and unshareable.

  • /boot Contains kernels and files necessary for booting, such as vmlinuz and ramdisk file (initrd). Grub may also be stored here. Static and unshareable.

  • /dev Contains device files, such as "/dev/sda" for the first (SCSI) hard disk. Normally, devices are claassified and stored in different directories. Static and unshareable.

  • /etc Contains configuration files. Static and unshareable.

  • /home Contains personal data of users, such as "/home/ztg" for user "ztg". Variable and shareable. (Optional)

  • /lib Contains basic libraries of system, which are used by most of the programs. The kernel modules are stored in "/lib/modules/KERNEL_VERSION". Static and unshareable. (Optional)

  • /lib32 Similar to /lib. Cotains 32-bit libraries only.

  • /lib64 Similar to /lib. Cotains 64-bit libraries only.

  • /lost found Normally empty. File fragments will be collected and moved here if file system encounters problems.

  • /media Similar to /mnt. Used for mounting removable media like USB stick.

  • /mnt Used for temporarily mounting. Variable and unshareable.

  • /opt Contains extra software, generally those installed by users.

  • /proc Virtual directory, generated by system during running. It is a map of system memory, and can be accessed to obtain system information.

  • /root The home directory of super user (root). Variable and unsahreable. (Optional)

  • /sbin Contains management tools used by system administrators. Other directories of this kind are: /usr/bin, /nsf/local/sbin. Static and unshareable.

/selinux Used by selinux mechanism.

/srv Contains files needed by some services.

/sys Contains core files of system. Since kernel 2.6, sysfs is introduced to /sys to provide information lik: process info (proc), device info (devfs) and fake terminals (derpts).

/tmp Contains temporary files, and are cleaned regularly. This is another directory that users can use beyond their home directories and /usr/local. Some system does not clean /tmp automatically, so it is necessary to remove unused file by hand. Variable and unshareable.

/usr Contains most of the programs, documents and libraries from system and installed by users. Generally, these files do not need to be modified.Static and shareable.

/var Contains variable files during system running, such as data from printer, mail system, news system, log files, formatted manuals and some application data. It is recommended to use a seperated partition for /var. The subdirectories can be either shareable or unshareable.

Swap Similar to virtual memory in Windows. When physical memory is not enough, system will use swap file (or swap partition) as memory.

How to understand moint point

Imagine the mount point of Linux as a huge tree. / is the root of this tree, other mount points are its branches, and files are leaves that grow under these mount points.

Mount file system

Using graphical interface

For normal user, the mostly used operation is mounting and unmounting partitions. Just open file manager, and find the partition you want in the left side, then click it to mount it. After using this partition, click the triangle sign next to that partition to unmount it.

Using command

Linux does not drive letter to represent file system. All file systems are mounted in directories.


Use mount to load specified file system to directory (i.e. mount point). You can write frequently used device to file /etc/fstab, so that system will automatically mount them during boot.

mount writes information of mounted devices in file /etc/mtab, and remove them after devices are unmounted (usually by "unmount" command).


mount [-afFhnrvVw] [-L] [-o] [-t] [Device name] [Mount point] 


    -a    Mount all devices mentioned in /etc/fstab

    -f    Do a "fake" mounting. Combined with option "-v" to show the executing process of mount

    -F    Used with "-a" option. Mount all devices in /etc/fstab simultaneously to speed up operations.

    -h    Show help information.

    -L    Mount file system that has specified label.

    -n    Do not add mounted device to /etc/mtab

    -o    Specify extra options for mounting. These options can also be appended to /etc/fstab. 

    Here are the options commonly used:

    async    All I/O to the filesystem should be done asynchronously.
    atime    Let kernel control the access time of inodes (i.e. place where files are stored)
    auto      Specify the device to be automatically mount by command "mount -a"
    defaults    Use default options (implying rw, suid, dev, exec, auto, nouser and async)
    dev        Interpret character or block special devices on the filesystem.
    exec      Permit execution of binaries.
    noatime Do no update access time of inodes.
    noauto   Do not allow command "mount -a" to automatically mount this device.
    nodev     Do not interpret character or block special devices on the file system. 
    noexec   Do not permit direct execution of any binaries on the mounted  filesystem. 
    nosuid    Do not allow SUID or SGID to take effect.
    nouser    Forbid  an ordinary user to mount the filesystem.
    remount Attempt  to  remount  an  already-mounted filesystem.
    ro          Mount the filesystem read-only. 
    rw          Mount the filesystem read-write. 
    suid      Allow SUID or SGID to take effect.
    sync     All I/O to the filesystem should be done synchronously. 
    user     Allow an ordinary user to mount the filesystem. 

    -r    Mount the filesystem read-only. 

    -t    Specify the type of file system. Here are some types commonly used:

    minix    The earliest file system supported by Linux
    ext2 / ext3 / ext4    Commonly used by Linux
    msdos    FAT file system used in MS-DOS
    vfat    vFAT file system used in Windows 95 and latter versions
    nfs    Network file system
    iso9660    Standard file system for CD and DVD
    ntfs    NTFS file system used in Windows NT and latter versions
    hpfs    HPFS file system used in OS/2, Windows NT 3.51 and earlier version
    auto    Try to detect file system type automatically

    -v    Show more details during executing.

    -V    Display version information and exit. 

    -w    Mount the filesystem read/write.


  1. Mount file system that has permission control

In order to mount the third partition (using ext3 file system) on the first parallel device to directory "/mnt/hd" in read-only mode, execute in terminal:

     mount -t ext3 /dev/hda3 /mnt/hd -o ro

Here, "-t ext3" tells mount that file system type is ext3, "/mnt/hd" tells mount where to mount this device, and "-o" tells mount extra options (read-only) to use during mouting.

The two options that need special concerns are "ro" and "rw".

  1. Mount file system that does not support Unix permission (such as vFAT or NTFS)

     mount -t vfat /dev/hda4 /mnt/hd -o uid=alan

In this case, "uid" and "gid" options are necessary for non-root user to access these file systems.


Use umount to unmount the file system that has already been mounted.


    umount[-ahnrvV][-t<Type>][File system or mount point]


    -a    Automatically unmount all file systems metioned in /etc/mtab
    -h    Show help information.
    -n    Do not remove entries in /etc/mtab.
    -r    If operation fails, try to re-mount file system read-only.
    -t    Unmount file systems that have specified type.
    -v    Show more details during executing.
    -V    Display version information and exit. 


  1. When unmounting partitions, you can either use device name or mount point to specify the file system:

    umount /dev/sdb1
    umount /media/disk

If the file system is being used, umount will show error:

     umount: /dev/sdb1: device is busy

You can use lsof command to show the process that occupy this file system:

     lsof /dev/sdb1

and then decide what to do with this process (wait or terminate it).

You can also use fuser to view details of process, as well as send signals to process. For example, to get the process that is accessing "/media/disk" and the accessing method:

     fuser /media/disk

Or, for more details, use:

     fuser -l /media/disk

Send SIGKILL signal to the process that is accessing /media/disk (this will terminate the process):

     fuser -k /media/disk

Note: fuser looks up only processes that are accessing directories, rather than devices.

lazy umount

lazy umount is used to unmount "busy" file system.

For example, /dev/sdb1 has been mounted to /media/disk, and it is in "busy" status, then we can use:

     umount -l /media/disk

to do a lazy mount. Note that this method is not very secure, as lazy mount does the followingn things:

  1. Remove file system from directory structure, i.e. new process could not access /dev/sdb1 through /media/disk, while processes that are currently accessing /dev/sdb1 are not affected;

  2. After all process finish their operations to /media/disk, system will unmount /dev/sdsb1 from /media/disk thoroughly.

Thus, lazy mount does not promise that the real unmounting will happen. It should only be used in some special cases, and may cause damages to removable device like USB sticks.


/etc/fstab is used to determine which file system should be mounted and checked. It has the form of table that describes the mounting options for each device to be mounted.

    $ cat /etc/fstab
    ## File system Mount point Type Option Dump  Fsck
    /dev/hda1 / reiserfs defaults 1 1
    /dev/hda2 /home reiserfs defaults 1 2
    /dev/hda3 swap swap defaults 0 0
    /dev/cdrom /mnt/cdrom auto noauto,owner,ro,users 0 0
    /dev/fd0 /mnt/floppy auto noauto,owner 0 0
    devpts /dev/pts devpts gid=5,mode=620 0 0
    proc /proc proc defaults 0 0

If the file system you want to mount already exists in /etc/fstab, then only mount point of that device is required to execute mount command:

    mount /dev/cdrom
    mount /home

Management of mount point

Reduce the usage of SWAP

If your machine has a memory of 2 GB or more, as well as a SWAP partition, the latter may reduce the speed of your machine (as disk I/O is generally slower than memory access). We can reduce the usage of SWAP to speed it up.

For a machine equipped with 1 GB RAM and 1 GB SWAP, it is better to set "swappiness" to "5", while the default value is "60".

Modify manually

Type in terminal:

     sudo gedit /etc/sysctl.conf 

In the text editor, you may see the folloing line:

     vm.swappiness = 60

If your RAM size is larger than 1 GB, you can change this value to 10 or 5.

Note: if you cannot find this line, just add one.

Frequently asked question

Why not mount Windows partition automatically during boot

Though many deepin users are also Windows users, deepin does not mount Windows partition automatically during boot, for the reason that:

  • Since Windows 8, the quick start function are enabled by default, making "shutdown" similar to "hibernate". Any changes written to Windows partition by Linux during hibernation will be lost when Windows is waked up

  • The startup process will get stuck If any of the Windows partitions has error

  • System may malfunction if Windows partitions are damaged or protected by encryption

If you really want to mount Windows partition during startup, then take your own risk and follow the instructions:

The first way:

  1. Disable "hybrid boot" in Windows, and make sure the partition you want to mount automatically has no error (please check it with chkdsk frequently);

  2. Open software "disks", click that partition, then click the gear symbol below to launch "Edit Mount Options";

  3. Uncheck the "Automatic mount options", then check "Mount at startup" and "Show in user interface", then click "OK"

Note: If partitions are not easy to recognized by their name, you can customize their names in "Display Name" field.

The second way:

We can use configuration tools for NTFS writing to automatically mount Windows partition. Execute in terminal:

     sudo apt-get install ntfs-config


Launch "NTFS Configuration Tool", then click the item you would like to enable or disable.

Caanot mount certain Windows partition

Please check for following causes:

  • "Hybrid boot" functions should be disabled, and computer should be restart once

  • Check if any data protection software exists

If the problem continues to exist, there might be something wrong with your partition table.

Why defined multiple partitions?

It is for the purpose that:

  • Reduce the data lose when partition format is needed, such as preserve /home when re-installing system

  • Use different types of file system for different needs to improve performance, such as reiserfs to /var, xfs to /home and ext4 to /

  • Apply different options when mounting file systems, such as synchronisation, journaling and compression.

The partition size for Linux is too small. Should I re-installal the system?

You can mount split some files into their own partitions, and mount them in correct place under root directory. For example, to transfer the data in /home to a seperated partition:

  1. Open Gparted, find a slice of free space, and create a ext4 partition on it;

  2. Remember the path of newly created partition, saying "dev/sda2", as well as its UUID;

  3. Create directory /mnt/home, and mount /dev/sda2 to it:
 cd  /mnt
sudo mkdir  home
sudo mount  /dev/sda2  /mnt/home
  1. Copy files under /home /to /mnt/home:
cd /home   
sudo cp -ar  *   /mnt/home
  1. Unmount partition /dev/sda2:

sudo umount /dev/sda2

  1. Modify /etc/fstab:

sudo gedit /etc/fstab

to add an entry for /dev/sda2:

UUID=[UUID of /dev/sda2]   /home   ext4  defaults  0  1

Save your changes.

  1. Reboot your computer, and see if /dev/sda2 has been successfully mounted to /home:


If yes, the input should be like:

Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda2       61691088   7026960  51500616   13% /home

Congratulations, you have transferred your data from original directory /home to partition /dev/sda2. The remained work is to clear the previous data in /home, which shall be done within TTY or with Live system, thus not mentioned here.

  1. You can also deal with /opt, /usr using this method. It is useful that you can easily backup your data during re-installation of system.



ubuntu Ubuntusoft:linux 挂载详解




学习 Linux,101: 查找并放置文件系统

Linux Deepin 论坛:图形化操作,实现开机自动挂载NTFS分区