I am describing all the essential information about each command, as I do in every post. It will make your understanding easy. Explaining each command here so that you will not forget commands after using at once.

I would suggest you to try running these commands yourself along with reading this post. Now plug your pen drive (or any USB flash drive) and follow these steps.

1. Find what the type of USB drive is?

You will need to know what kind of drive is called to mount. To find this, just run fdisk command as below.

sudo fdisk -l

It will print all the partition table attached to your Linux (Ubuntu) system.

For USB, you’re looking for a partition that should look something like: /dev/sdb1. Remember what it’s called.

Note: On Ubuntu, Linux Mint or other Ubuntu-derived distributions, you just need to use a prefixed ‘sudo’ to run any ‘fdisk’ command. Some Linux distributions don’t support sudo prefix. In that case, use the ‘su’ – command first and then enter your root password. After that, you will get a root shell. Now you can run any command without any ‘sudo’ prefix.

With this step, you know the type of USB flash drive you have connected.

2. How to Create a Mount Point?

For ease of understanding, consider everything in Linux is structured as files and directories. So even if you are connecting a USB drive, you have to mount it to your system directory.

The best way is to create a new directory in /media using ‘mkdir’ command.

sudo mkdir /media/usb

You can create a directory with any name (preferably create a directory inside media).

We are using this newly created directory to mount our connected USB drive.

3. How to Mount USB drive in Linux?

Following is the command with that you can mount the drive onto the Linux file system:

sudo mount /dev/sdb1 /media/usb

‘/media/usb’ is a newly created directory in the second step.

Once you have mounted the USB drive, you can see all the mounted file system on your Linux with the simple mount command.

mount

You can see the USB flash drive mounted there.

Now you can easily access the USB mounted files in ‘/media/usb’ directory.

To find the disk usage of your mounted file system, use du command. It is useful when you want to know how much data is there on the connected USB drive and how much space is free to use.

Now you can do whatever you want with data in your USB flash drive.

Never forget to unmount a USB drive after using it. Removing the USB device without unmounting, may damage your data. So follow the fourth step.

4. umount USB drive in Linux:

Once you’re done with using data from mounted USB drive, you need to unmount it.

sudo umount /media/usb

Note: Kindly don’t take a risk to remove a USB device without unmounting, it can corrupt your data in the USB drive.

5. Umount USB drive when it is busy:

Sometimes, you might have seen the message “Linux cannot umount as the target is busy”.

This is mainly because some other applications might be using this device location. To umount the device, you have to force the system to umount this device.

This can be achieved by providing ‘-l’ option.

sudo umount /media/usb -l

We have seen How to Mount USB Drive in Linux. But again, you may have GUI access where you can access all connected devices. Then why do I need mounting USB drive through terminal?

I am sharing my experience where these commands saved my data. Saving my precious data can never be less than saving my life. It might be true for you.

So here it is…

Where do I find these commands useful?

Last week my Linux crashed, and I was not able to log in through GUI. So the only option I had to log in through shell terminal. (To log in through shell terminal, keep pressing ctrl + alt+ f1 while powering on.) With these commands, I took a backup in my USB flash drive before resolving the issue with crashed Linux.

So the technique – how to mount USB drive in Linux, comes as a bulletproof for me to save myself from data loss.

Note:

All these commands are tested and working fine on a Ubuntu system and it will work on any Linux-based system.

If you are log in as system administration, you can skip using ‘sudo’ keyword in command. Run all above command without ‘sudo’.

Here is a pro tip for you. This will make your learning easy with commands.

Pro Tips: If you are Linux user, I would suggest you learn shell scripting commands. You will find these all terminal commands very easy and useful in your daily work. If you have not read my last article about shell scripting, do read that. This article will guide you to start learning commands.

This is all about how to mount USB drive in Linux, accessing data from USB drive and umount USB drive in Linux system. If you have any questions, feel free to write in the comment section.

I am complete Python Nut, love Linux and vim as an editor. I hold a Master of Computer Science from NIT Trichy. I dabble in C/C++, Java too. I keep sharing my coding knowledge and my own experience on CSEstack.org portal.