
Mounting a USB Drive On Linux
First, determine the mount point’s location by listing the root directory.
root@xxxxxx:/# ls
bin dev home lib64 media
opt root sbin sys usr
boot etc lib lost+found mnt
proc run srv tmp var
root@axxxxx:/# cd mnt
root@xxxxxx:/mnt# ls
root@xxxxxx:/# !Here no storage devices mounted(Note)
Creating a Mount point: A mount point is a location on your directory tree to mount the partition. The default location is /media although you may use alternate locations such as /mnt or your home directory.
Note: We are using /mnt here to mount point (mnt) and the partition (usbdrive).
root@xxxxxx:/# mkdir /mnt/usbdrive
root@xxxxxx:/#
root@xxxxxx:/#
root@xxxxxx:/# ls /mnt/
usbdrive
Created the USB drive partition here.
Mounting the USB Drive
(A) Note: Here i used “TAB” to display both device node
root@xxxxxx:/# mount /dev/sdc
sdc sdc1
(B)—root@xxxxxx:/# mount /dev/sdc1 /mnt/usbdrive/
Now listing the mount driveand partition we have
root@xxxxxx:/# ls mnt/usbdrive/
dump lost+found
How to get a usb uuid to make the partition auto-mount
First find out the UUID by using this parameter ( /dev/sda3) or ( /dev/sdxy)
or alternatively by doing (sudo blkid)
root@xxxxxx:/# ls /dev/disk/by-uuid/
16b4a593-92ed-4ea0-b7ef-72b6a655c554 b505d17c-eaab-48ab-af5d-922267d4bfee
190D-B412 b7cf9ba6-f97b-4863-8c94-2973d09bbe6c
4aa11a9a-ebda-41c9-b694-a12a00f0100f fe932ccb-2ebe-4727-a5ea-d70142ed371f
667e0094-352e-461c-a568-e182677465fb
root@xxxxxx:/#
Note: Partitions listed in fstab may automatically mount during the boot process with configuration.
Only ROOT can mount a device/partition not listed in fstab.
Now to make the usb persistant when ever it reboots, you have to edit /etc/fstab file and also specify the file system.
root@alaska:/# nano /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext4 errors=remount-ro 0 1
/dev/pve/data /var/lib/vz ext4 defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0
/dev/disk/by-uuid/16b4a593-92ed-4ea0-b7ef-72b6a655c554 /mnt/usbdrive ext4 defaults 0 1
Note: we added the last line above for the mounted usb
How to use the cat command to view it
root@alaska:/# cat /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext4 errors=remount-ro 0 1
/dev/pve/data /var/lib/vz ext4 defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0
/dev/disk/by-uuid/16b4a593-92ed-4ea0-b7ef-72b6a655c554 /mnt/usbdrive ext4 defaults 0 1
Dump and Pass explanation: Dump: This field sets whether the backup utility dump will backup file system. When set to “0,” the system ignores the file system; when set to “1,” it backs up the file system.
Dump is seldom used and if in doubt use 0.
root@xxxxxx:/#
Note: Pass (fsck order): Fsck order is to tell fsck what order to check the file systems, if set to “0” file system is ignored.
Often a source of confusion, there are only 3 options :
0 == do not check.
1 == check this partition first.
2 == check this partition(s) next
In practice, use "1" for your root partition, / and 2 for the rest.
All partitions marked with a "2" are checked in sequence and you do not need to specify an order.
See these links for more information on how to mount a usb drive
– http://unix.stackexchange.com/questions/72393/mounting-all-partitions-on-hard-disk-automatically-on-linux-mint
– http://askubuntu.com/questions/45607/how-to-mount-partition-permanentlyhttps://wiki.archlinux.org/index.php/USB_storage_devices
– https://help.ubuntu.com/community/Fstab
Also See the #man mount on any of your favourite linux distribution.