When we insert a USB stick into our Linux system, it is usually automatically recognized and mounted by the system. More often than not, it mounts a USB stick by creating a directory by username in the media directory. However, this is not always the case; in some cases, you may need to manually connect / disconnect the USB device to your system.
In this article, we will explain how you can use a USB device on your Debian system by manually connecting to your system. We’ll also explain how to unmount it after you’re done using the device.
How to mount a USB stick in Debian
To manually connect a USB drive to your system, follow these steps:
Insert the USB stick into any of the available ports on your system.
Open Terminal by pressing the super key on your keyboard and searching for the Terminal app by typing its keyword in the search bar. When the terminal icon appears, click it to open it.
Now in Terminal, run this command to check the available devices on your system:
$ sudo fdisk –l
Make a note of the USB device name that may appear at the end of the output, usually labeled as sdb1, sdb2, etc. In our case, it is listed as sdb1.
Then create a mount point where your USB device will be mounted. To do this, use the mkdir command in Terminal as follows:
$ sudo mkdir /media/[mountPoint_Name]
For example, we create a mount point here named “myusb”.
$ sudo mkdir /media/myusb
Note. Do not add spaces in the mount point name. Instead, use the underscore “_” to separate words.
After creating a mount point, you will need to mount your USB stick at that mount point. To do this, run this command in Terminal:
$ sudo mount -t vfat /dev/sdb1 /media/myusb -o
uid=1000 gid=1000 Utf8 dmask=027 fmask=137
The USB device is now mounted. To access the USB device, open the file manager and access it as follows:
Alternatively, you can access the USB stick via the / media directory as follows:
$ ls /media
How to unmount a USB stick in Debian
After you are done using your USB drive, it is best to unplug the device.
Run this command in Terminal to manually disconnect the USB device.
$ sudo umount /dev/sdb1
Note: The command to unmount a disk is “unmount” instead of unmount.
Also remove the mount point directory if you don’t want to use it in the future.
$ sudo rmdir /media/myusb/
After that, remove the USB stick from your system.
That’s all! In this article, we have explained how you can use a USB device on your system by manually mounting and unmounting it. This can be very useful if your system cannot automatically mount / unmount the USB device.
How to use a USB stick in Debian 10