How to Mount and Unmount USB Device in Ubuntu 20.04
When you connect a USB drive to our system, it is normally automatically mounted and a directory named after your user name is established beneath the media folder. You can also use your system’s file manager to get to it. Unfortunately, this isn’t always the case; in certain cases, you’ll have to manually mount the USB device in order to use it.
We’ll show you how to manually mount and unmount a USB device on your computer in this article. On an Ubuntu 20.04 LTS system, the commands and steps mentioned in this article were executed.
How to use Ubuntu to mount a USB device
To manually mount a USB device to your PC, follow these steps:
- Connect the USB drive to a free port.
- In your Terminal application, run the following command as sudo to examine the available storage devices on your system and the file system they’re using:
$ sudo fdisk –l
Typically, your USB device will be listed at the end of the output as sdb- (number). In our case, its sdb1, which uses the FAT32 file system?
- Use the following command to create a mount point for your USB device:
$ sudo mkdir /media/[mountPointName]
Note that spaces cannot be used in the name of your mount point; instead, use an underscore ‘_’ to separate the words.
$ sudo mkdir /media/USB
The mount point will be made now.
- We’ll now mount the USB storage device to the mount point we created earlier. To mount a FAT32 device, we’ll use the following command:
$ sudo mount -t vfat /dev/sdb1 /media/USB -o [securityoption]
The security option is required and allows you to grant or deny access to the USB by selecting one of the following permission values:
uid=1000
gid=1000
Utf8
dmask=027
fmask=137
I’m granting access control to a user (the current user) in this example by specifying the user id:
Use the following command for NTFS:
$ sudo mount -t ntfs-3g /dev/sdb1 /media/USB
- Your USB drive is now mounted. It’s in your media folder, and you can find it there.
The file manager can also be used to access USB. My mounted USB storage is the 16 GB Volume shown just above Other Locations in the following image.
How do I unmount a USB drive on Ubuntu 20.04?
If you manually installed a USB drive, you need also manually unmount it.
- To unmount your USB, use the following command:
$ sudo umount /dev/sdb1
And
$ sudo umount /media/USB
If you want to use a mount point other than the ‘USB’ mount point I used, provide it in the above command.
Your USB drive will be removed from your computer:
- If you don’t plan to reuse the USB mount point directory in the future, you’ll need to manually remove it as follows:
- Disconnect the USB cable from your computer.
You will be able to successfully mount and unmount a USB storage device to and from your system after following the methods outlined in this article. This will assist you if your system fails to make the USB accessible and usable automatically.