mount Command Examples in Linux

The mount command loads a file system to a specified directory so that it can be accessible to users and applications. You must specify the device to mount as well as the desired mount point.

Syntax

The syntax of the mount command is:

# mount [options] {device name} {mount point}

mount Options

You can specify various mount options for a file system. These options are typically included in the fstab file rather than as command-line arguments.

Option Used To
auto Specify that the device has to be mounted automatically.
noauto Specify that the device should not be mounted automatically
nouser Specify that only the root user can mount a device or a file system.
user Specify that all users can mount a device or a file system.
exec Allow binaries in a file system to be executed.
noexec Prevent binaries in a file system from being executed.
ro Mount a file system as read-only.
rw Mount a file system with read and write permissions.
sync Specify that input and output operations in a file system should be done synchronously.
async Specify that input and output operations in a file system should be done asynchronously.

Mount Command Examples

1. To mount a file system:

# mount /dev/sda /support 

2. To specify the file system type:

# mount -t nfs 192.168.100.22:/home /home 

3. To mount all the file systems from “/etc/fstab”:

# mount -a 

4. To do the fake mounting:

# mount -f /dev/sda /support
# mount --fake /dev/sda /support 

5. To add the labels to the mount points;

# mount -l mymount /support ***** 

6. To mount without writting into “/etc/mnttab”:

# mount -n /dev/sda /support
# mount --no-mtab /dev/sda /support 

7. To avoid canonicalize paths:

# mount --no-canonicalize /dev/sdb /support 

8. To ignore ignore mount options not supported by file system type:

# mount -s /dev/sdb /support 

9. To mount a file system as read only:

# mount -r /dev/sdb /support
# mount --read-only /dev/sdb /support 

10. To Mount the filesystem read/write:

# mount -w /dev/sdb /support
# mount --rw /dev/sdb /support 

11. To mount the file system of specified label:

# mount -L mymount 

12. To mount the partition that has the specified uuid:

# mount -U uuid  

13. To mount the file system with specified options:

# mount -o noatime,nouser /dev/sdb /support
# mount --options noatime,nouser /dev/sdb /support 

14. To get the help:

# mount -h 

15. To get the version info:

# mount -V 
Related Post