How to Mount USB and Storage Devices on Linux
How to Mount a USB Stick or Other Storage
In this post, I will guide you through the steps to easily mount a USB stick or a Storage (HDD/SSD) on a Linux system. Whether you're new to Linux or simply need a refresher, this tutorial will cover everything you need to know to access your storage devices in just a few commands.
Mounting external storage devices, like USB sticks, is a common task, but it can vary slightly depending on the type of device and filesystem.
Let’s dive into the process for both types of storage!
Update Your System
Bring your system up to date.
You need root privileges. On Ubuntu, sudo
is usually pre-installed, and on Debian, you can try using su
to gain root privileges.
apt update
or
su apt update
or
sudo apt update
The important commands must be executed as root, so we will install or check if sudo
is installed.
apt install sudo -y
or
su apt install sudo -y
or
sudo apt install sudo -y
Plug in the USB Stick or connect the Storage or HDD/SSD
Enter the command into the terminal, and all storage devices will be displayed.
lsblk
Here you can see that the drive is not yet mounted, as there is no branching like with the 'sda' drive.
Create a New Folder
Now, we will create a new folder, and the drive will be mounted in this folder. The mnt
directory already exists on every Linux system, and we will create a new folder inside it for our mount point.
sudo mkdir /mnt/usb
Now we have created the folder usb
in the mnt
directory.
The Mount Command
Now we enter the mount command. The drive will now be linked to the newly created folder, and you will have access to the drive through this folder.
The command now links the drive to the folder. This means the first part of the command specifies the path to the drive, and the second part specifies the path to the folder with which the drive will be linked.
In this example, the drive is labeled 'sdb', but it might be different on your system. It's important that you enter the correct label in the command.
sudo mount /dev/sdb /mnt/usb
Check Storage
Enter the lsblk
command again, and you will see that the drive has been linked to the desired folder. You can now transfer data to the drive through this folder.
Troubleshooting
Wrong "FS Type"
If this error message appears, it means that the drive has the wrong format. I recommend formatting the drive to ext4, and I'll show you how. Attention: All data on the drive will be deleted. Once the drive is formatted, you can mount it.
You should already know the drive designation by now. Adjust the command with your drive accordingly.
sudo mkfs.ext4 /dev/sdb