• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mount Command Examples in Linux

by admin

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 

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Rename KVM VM with virsh
  2. lpr: command not found
  3. pacman –database Command Examples in Arch Linux
  4. How to use Exit Codes in Conditional Statements in Shell Scripts
  5. rankmirrors Command Examples in Linux
  6. jpegtran for image optimization
  7. Using iostat to monitor system performance in Linux (Examples included)
  8. CentOS / RHEL 6,7 : How to configure hugepages
  9. avo: The official command-line interface for Avo (Command Examples)
  10. rename: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright