When we insert a USB drive in our Linux system, it is normally automatically recognized and mounted by the system. Most often, it mounts the USB drive by creating a directory by the user name under the media directory. However, this is not always the case; in some cases, you might need to mount/umount the USB device manually to your system.
In this article, we will explain how you can use a USB device in your Debian system by manually mounting in your system. We will also explain how to unmount it after you are finished using the device.
How to mount a USB drive on Debian
To manually mount the USB drive to your system, follows the below steps:
Insert the USB drive in any of the available ports in your system.
Open the Terminal by hitting the super key on your keyboard and searching for the Terminal application by typing its keyword in the search bar. When the Terminal icon appears, click on it to open.
Now in the Terminal, run this command to check the available devices on your system:
$ sudo fdisk –l
Note down the USB device name which might be listed at the end of the output usually labeled as sdb1, sdb2, etc. In our case, it is listed as sdb1.
Next, create a mount point where your USB device will be mounted. To do so, use the mkdir command in Terminal as follows:
$ sudo mkdir /media/[mountPoint_Name]
For instance, we creating here the mount point named “myusb”.
$ sudo mkdir /media/myusb
Note: Do not add spaces in your mount point name. Instead, use underscore “_” symbol to separate words.
Once the mount point is created, you will need to mount the USB drive at this mount point. To do so, run this command in Terminal:
$ sudo mount -t vfat /dev/sdb1 /media/myusb -o <securityoptions>
The <securityoption> section is compulsory. It enables you to give access to the USB device by allowing one of the following permissions attributes:
uid=1000 gid=1000 Utf8 dmask=027 fmask=137
Now the USB device has been mounted. To access the USB device, open the File Manager, and access it as follows:
Alternatively, you can access the USB drive through the /media directory as follows:
$ ls /media
How to unmount a USB drive on Debian
Once you are finished using the USB drive, it is better to unmount the device.
Run this command in Terminal to manually umount the USB device.
$ sudo umount /dev/sdb1
Note: the command to unmount the drive is “umount” instead of unmounting.
Also, remove the mount point directory if you do not want to use it in the future.
$ sudo rmdir /media/myusb/
Once done, remove the USB drive from your system.
That is all there is to it! In this article, we have explained how you can use a USB device in your system by manually mounting and unmounting it. It can be very helpful if your system fails to automatically mount/umount the USB device.