When you connect a USB drive to our system, it is usually mounted automatically and a directory with your user name is created under the media folder. You can also access it through your system’s file manager. Unfortunately, this is not always the case; sometimes you need to manually mount the USB drive in your system to access it.
In this tutorial, we will explain how to manually mount and unmount a USB drive to your system. The commands and steps described in this article will work on any recent Ubuntu version including Ubuntu 22.04.
How to mount a USB drive on Ubuntu
Let us follow these steps to mount a USB drive manually to your system:
Step1: Plug in the USB drive to an available port.
Step2: Run the following command as sudo in your Terminal application in order to check the available storage devices on your system and the file system they are using:
$ sudo fdisk -l
Your USB device will usually be listed at the end of the output mostly as sdb-(number). In our case it is listed as sdb1, running a FAT32 file system.
Step3: Create a mount point for your USB device through the following command:
$ sudo mkdir /media/[mountPointName]
Note: The name of your mount point can not include spaces; you can seperate the words through an underscore ‘_’.
$ sudo mkdir /media/USB
The mount point will now be created.
Step4: Now we shall mount the USB storage device to the mount point that we created. We will use the following command in order to mount a FAT32 device:
$ sudo mount -t vfat /dev/sdb1 /media/USB -o [securityoption]
The security option is mandatory and allows you to give/gain access to the USB by specifying one of the following values for permission;
In this example, I am giving access control to a user (the current user) by specifying the user id:
For NTFS, use the following command:
$ sudo mount -t ntfs-3g /dev/sdb1 /media/USB
Step5: Your USB has now been mounted. You can access it through your media folder.
You can also access USB through the file manager. In the following image, the 16 GB Volume listed right above Other Locations is my mounted USB storage.
How to unmount a USB drive on Ubuntu
If you have mounted a USB manually, it is best to even unmount it manually.
Step1: Use the following command in order to unmount your USB:
$ sudo umount /dev/sdb1
$ sudo umount /media/USB
In the above command, specify the mount point if it is something other than the ‘USB’ mount point I have used.
Your USB will be unmounted from your system:
Step2: You will need to remove the USB mount point directory manually as follows if you don’t plan to reuse it in the future:
Step3: Unplug the USB from your system.
After following the steps described in this article, you will be successfully able to mount and unmount a USB storage device to and from your system. This will help you if your system fails to automatically make the USB available for access and use.