How To Mount/Unmount USB Drive On Ubuntu And Other Linux Distros?

How To Mount/Unmount USB Drive On Ubuntu And Other Linux Distros?


Is your USB drive not showing on your Linux system? Are you unable to access your external disk drive? By mounting your USB drive to the Linux filesystem, you can resolve this issue. In this article, let’s look at how to mount and unmount the USB flash drives or external hard disks in Linux.

This article will go through both command line and graphical user interface (GUI) methods. The former method for mounting a USB drive works on all Linux distributions. However, if you’re a beginner and use Ubuntu or Ubuntu-based distributions, you can mount using the GUI application.

Why Is USB Not Detected In Linux?

If you plug in your USB device (aka USB sticks, thumb drives, and Pendrive) for the first time, Linux usually mounts it automatically. But sometimes, Linux fails to recognize and mount a USB drive to its filesystem. This is why you find the USB not showing on the Linux operating system.

Linux filesystem follows a tree directory structure with all files and folders attached to a single root directory. So, if you want to access and use external storage devices, first, you have to mount it to the Linux filesystem.

To mount a USB drive in Linux using a terminal, follow the step-by-step instructions given below. If you’re using Ubuntu Linux and aren’t familiar with the command line, skip the first method to the next one and mount and unmount the USB drive using the Ubuntu GUI application.

How To Mount USB Drive In Linux Using Command Line

1. Detect Plugged In USB Device

Once you plug in your USB device to your system USB port, run the following command to locate the USB device:

sudo lsblk
Running command to detect USB device
Running command to detect USB device

Now you can see the detected USB device named ‘sdb.’ Your device name may differ from mine, so you can find the device name matching its size.

You can also notice that the device ‘sdb’ has no mount point here. If you also find the same, it means the USB drive is not mounted to the Linux system. Hence, you can’t access your drive files and folders.

2. Create a Mount Point

To access the USB drive data, we’ve to create a directory that will act as a mount point in the Linux filesystem. Here, I’m creating a new directory at ‘/media’, where we’ll mount the device later.

sudo mkdir /media/pendrive

However, creating a directory to mount and access a drive is an optional step; you can also directly attach it to the ‘/media’ directory.

Creating a mount point
Creating a mount point

3. Mount USB Drive To Mount Point

We’re now ready to link the USB device to the Linux filesystem and access its data. We’ll use the ‘mount’ utility program to do the same. If you want to know about ‘mount,’ read its manual using:

man mount
About mount
About mount

If your USB disk drive has a FAT16 or FAT32 file system, you can mount the device by running the command:

sudo mount /dev/sdb /media/pendrive

Replace ‘sdb’ with your device name.

Running command to mount the USB device
Running command to mount the USB device.

Most USB flash drives use FAT16 or FAT32, while some external hard disks use NTFS. If you have a file system other than FAT, use a flag to specify file system type like ntfs-3g for NTFS.

sudo mount -t ntfs-3g /dev/sdb /media/pendrive

4. Check For The Device Mounted

If all goes well with the previous steps, you can now access your USB drive file and folders. You can check the status of the device using the same ‘lsblk’ command:

sudo lsblk
The device is mounted at a mount point
The device is mounted at a mount point

As you can see, the USB drive ‘sdb’ now has a mount point which means it is mounted at that location. So, navigate to the directory (mount point) where you can access your drive data.

cd /media/pendrive/

How to Unmount USB Drive In Linux Using Command Line

Unmounting the USB device is just a one-line command using ‘umount’:

sudo umount /media/pendrive
Running command to detect the mounted USB device
Running command to detect the mounted USB device

You can see that the mount point has been removed, and you can again no longer access your USB drive.

Note: Most Linux distros configure the settings to automount the same USB drive to the system for future use. But if you’re again unable to access your USB device, you can either perform the same steps or manually set the device to automount. You can follow our article on how to automount par titions on boot.

How To Mount USB Drive On Ubuntu Using GUI

Mounting an external drive or USB flash drive using the GUI application is pretty straightforward. Several Linux distros already offer GUI applications for the same. Here, I’ll guide you to mount/unmount a USB drive on Ubuntu using the GUI application.

1. Open Disks Application

Open the Activities overview from the top left corner and search for the ‘Disks’ application.

Search For Disks
Search for Disks

Click to open the app, and you will notice that it automatically displays the ‘Not Mounted’ status for connected USB devices.

Device Not Mounted
Device Not Mounted

2. Mount A USB Device To Ubuntu Linux Filesystem

Just click on the play button to mount the USB drive, as pointed out in the picture below. It will automatically create a mount point and attach the device to it.

Click To Mount
Click To Mount

3. Check For The Mounted Device

The moment you click on the play button, you’ll notice a drive icon pop up in your dock.

USB Drive Icon
USB Drive Icon

If you click on the icon, it will open the USB drive in the file manager, where you can access all your drive data.

USB Drive Data
USB Drive Data

You can also see the USB drive status ‘Mounted’ with mount point location at ‘/media/<username>/<drive-name>’.

Mounted Device With Mount Point
Mounted Device With Mounting Point

4. Unmount USB drive On Ubuntu

Lastly, click on the same play button to detach or unmount the USB drive from the Ubuntu Linux system.

Unmount The USB Drive
Unmount The USB Drive

So, that was how you could mount/unmount USB drives on Ubuntu and other distros using the Terminal and GUI. If you have any questions or find the guide difficult to follow, let us know in the comments section below.



Source link

Share:

Facebook
Twitter
Pinterest
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

Most Popular

Social Media

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

Categories