In this article you will see how to mount a USB Flash Drive on CentOS 7 terminal. In this case, we need to mount a USB Flash Drive on a minimal CentOS 7 machine to copy a file to the USB Flash Drive.
The file system of the USB flash drive is FAT32. We will use a Windows 10 computer to create a folder called System Volume Information on the USB flash drive.
Mounting
First, go to your CentOS 7 computer and create a folder where you’ll mount the contents of the USB flash drive to.
mkdir -p /media/USB
/dev is a location that represents devices attached to your computer. Check the /dev directory’s contents by typing:
ls /dev/sd (then hit tab)
You should see something like this:
sda sda1 sda2
Next, insert your USB flash drive into the CentOS 7 machine. Type again ls /dev/sd (then hit tab). You should see a new sdb and sdb1.
Our USB flash drive is represented by /dev/sdb1. We will mount the USB flash drive to the /media/USB folder that we created earlier.
mount -t vfat /dev/sdb1 /media/USB
Check if the USB flash drive is mounted by listing the contents of /media/USB.
[root@buhpc6 ~]# ls /media/USB System Volume Information
Since the /media/USB contains System Volume Information, we know that the USB flash drive was mounted properly. Now, we can copy any file to the mounted USB flash drive folder.
cp nfs-utils-1.3.0-0.21.el7_2.x86_64.rpm /media/USB/
Unmounting
After you are done with the USB flash drive, always remember to unmount the USB flash drive from the folder it is mounted on.
umount /media/USB
You can now safely eject the USB flash drive from the CentOS 7 machine.