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 <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
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
chkconfig nfs on service nfs start service nfs status
Mount the share.
mount -t nfs fs1.example.com:/srv/nfs/share /mnt/example