Linux Commands - mount (mount a partition or share)

The mount command can be used to display the currently mounted partitions and to also temporarily mount a partition.


Display currently mounted partitions

The mount command with no additional command line options or flags will display the currently mounted partitions, which will typically return something like this. In this example, the LVM fedora_fedora-root volume is mounted to the / (root) directory, and there is also a temp mount, and the network shared partition // is mounted to the /mnt directory.

~]# mount
/dev/mapper/fedora_fedora-root on / type xfs
tmpfs on /run type tmpfs
// on /mnt type cifs


UUID or Label

A partition is often mounted using the Universally Unique Identified (UUID) or Label of the partition. A partition can be a variety of different storage devices, such as a solid state drive, USB drive, CD/DVD drive, or hard disk. The e2label command can be used to label a partition. The blkid command followed by the path to the partition can be used to determine the UUID or Label of the partition.

blkid /dev/sda1
/dev/sda1: LABEL="MyLabel" UUID="7016c299-b6b1-40ad-80f0-e4dd0b3def65" TYPE="xfs"


The UUID of the partition may be listed in the /dev/disk/by-uuid directory.

ls -l /dev/disk/by-uuid
lrwxrwxrwx. 1 root root 10 Jun 27 19:15 7016c299-b6b1-40ad-80f0-e4dd0b3def65 -> ../../sda1


Mounting physical local partition

The mount -t or --types <file system> <partition to mount> <mount point> command can be used to temporarily mount the partition.

mount --types xfs /dev/mapper/myVG-myLV /mnt


The UUID can also be used.

Use the mount command followed by the UUID or Label and then the mount point.

mount --types vfat 7016c299-b6b1-40ad-80f0-e4dd0b3def65 /home


The Label can also be used.

mount --types ext myLabel /mnt


Mounting a shared network drive using CIFS (common Internet file system)

Use apt-get or yum to install the CIFS utilities.

yum install cifs-utils


If the network drive is configured to permit guest access, meaning there is no need to provide a username and password to access the network drive, the following is all that should be needed to mount the network drive.

mount --types cifs // /mnt


If a username and password is required to access the network drive, add the username and password options to the mount command.

mount --types cifs // /mnt -o username=john.doe,password=MyPassword,vers=2.0


Additional options can also be selected, such as uid, gid, file_mode and dir_mode.

mount --types cifs // /mnt -o username=john.doe,password=MyPassword,vers=2.0,domain=EXAMPLE,uid=root,gid=root,file_mode=0640,dir_mode=0750


Mounting a shared network drive using NFS (Network File System)

To use NFS, NFS must be installed and configured on the server.

Use apt-get or yum to install the nfs-common package.

yum install nfs-utils


The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to start and enable NFS.

systemctl enable nfs 
systemctl start nfs 
systemctl status nfs 


If your system is using init, use the chkconfig and service commands to start and enable NFS.

chkconfig nfs on
service nfs start
service nfs status


Mount the share.

mount --types nfs /mnt/example


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 8931e in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |