Temporarily mount a partition or share using the MOUNT command in Linux

Home > Search > Linux commands
  by

UUID or Label

A partition 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 <file system> <partition to mount> <mount point> command can be used to temporarily mount the partition.

~]# mount -t 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 -t vfat 7016c299-b6b1-40ad-80f0-e4dd0b3def65 /home

 

The Label can also be used.

~]# mount -t 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 -t cifs //fs1.example.com/share /mnt

 

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

~]# mount -t cifs //fs1.example.com/share /mnt -o username=john.doe,password=MyPassword

 

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

~]# mount -t cifs //fs1.example.com/share /mnt -o username=john.doe,password=MyPassword,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

 

Start and enable NFS.

~]# systemctl start nfs
~]# systemctl enable nfs
~]# systemctl status nfs

 

Mount the share.

~]# mount -t nfs fs1.example.com:/srv/nfs/share /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 in the box below so that we can be sure you are a human.




Comments