Is your USB drive not showing on your Linux system? Also, are you unable to access your external disk drive? You can resolve this issue by mounting your USB drive to the Linux filesystem. But do you know how to mount and unmount the USB flash drives or external hard disks in Linux?
Here, I’m going to tell you how to mount and unmount USB drives using both command line and graphical user interface (GUI) methods. In this article, I’ll guide you to mount a USB drive using a terminal that applies for all Linux distributions. But if you’re a beginner and use Ubuntu 20.04, you can simply mount using the GUI application.
Why Is USB Not Detected In Linux?
If you plug in your USB device (aka USB sticks, thumb drives, and Pendrive) for the first time, Linux usually mounts it automatically. But sometimes Linux fails to recognize and mount a USB drive to its filesystem. This is the reason you find the USB not showing on the Linux operating system.
Linux filesystem follows a tree directory structure with all files and folders attached to a single root directory. So, if you want to access and use external storage devices, first you have to mount it to the Linux filesystem.
Now, to mount a USB drive in Linux using a terminal, follow the step-by-step instructions given below. If you’re using Ubuntu Linux and aren’t familiar with the command line, skip the first method to the next one and mount and unmount USB drive using the Ubuntu GUI application.
How To Mount USB Drive In Linux Using Command Line
1. Detect Plugged In USB Device
Once you plug in your USB device to your system USB port, run the following command to locate the USB device:
Now you can see the detected USB device named ‘sdb.’ Your device name may differ from mine so you can find the device name matching its size.
Here, you can also notice that the device ‘sdb’ has no mount point. If you also find the same it means the USB drive is not mounted to the Linux system. Hence, you can’t access your drive files and folders.
2. Create a Mount Point
To access the USB drive data, we’ve to create a directory that will act as a mount point in the Linux filesystem. Here, I’m creating a new directory at ‘/media’ where we’ll mount the device later.
sudo mkdir /media/pendrive
However, creating a directory to mount and access a drive is an optional step, you can also directly attach it to ‘/media’ directory.
3. Mount USB Drive To Mount Point
We’re now ready to link the USB device to the Linux filesystem and access its data. To do the same, we’ll use the ‘mount’ utility program. If you want to know about ‘mount’, read its manual using:
If your USB disk drive has FAT16 or FAT32 file system, you can mount the device by running the command:
sudo mount /dev/sdb /media/pendrive
Replace ‘sdb’ with your device name.
Most USB flash drives use FAT16 or FAT32 while some external hard disks use NTFS. If you have a file system other than FAT, use flag to specify file system type like ntfs-3g for NTFS.
sudo mount -t ntfs-3g /dev/sdb /media/pendrive
4. Check For The Device Mounted
If all goes well with the previous steps, you can now access your USB drive file and folders. You can check the status of the device using the same ‘lsblk’ command:
As you can see, the USB drive ‘sdb’ now has a mount point which means it is mounted at that location. So, navigate to the directory (mount point) where you can access your drive data.
How to Unmount USB Drive In Linux Using Command Line
Unmounting the USB device is just a one-line command using ‘umount’:
sudo umount /media/pendrive
You can see that the mount point has been removed and you can again no longer access your USB drive.
Note: Most Linux distros configure the settings to automount the same USB drive to the system for future use. But if you’re again unable to access your USB device, you can either perform the same steps or manually set the device to automount. You can follow our article on how to automount partitions on boot.
How To Mount USB Drive On Ubuntu Using GUI
Mounting an external drive or USB flash drive using the GUI application is pretty straight forward. Several Linux distros already offer GUI applications for the same. Here, I’ll guide you to mount/unmount a USB drive on Ubuntu using the GUI application.
1. Open Disks Application
Open the Activities overview from the top left corner and search for the ‘Disks’ application.
Click to open the app and you will notice that it automatically displays the ‘Not Mounted’ status for connected USB devices.
2. Mount A USB Device To Ubuntu Linux Filesystem
To mount the USB drive, just click on the play button as pointed in the picture below. It will automatically create a mount point and attach the device to it.
3. Check For The Mounted Device
The moment you click on the play button, you’ll notice a drive icon popped up in your dock.
If you click on the icon, it will open the USB drive in file manager where you can access all your drive data.
You can also see the USB drive status ‘Mounted’ with mount point location at ‘/media/<username>/<drive-name>’.
4. Unmount USB drive On Ubuntu
Lastly, click on the same play button to detach or unmount the USB drive from the Ubuntu Linux system.