Mount a USB drive in Linux

Problem

How to mount an external USB drive in Linux so it is accessible to your file system.

tl;dr

Find out the name/partition of your device:

fdisk -l

Mount it to a directory:

mount -t ext4 /dev/sdb1 /mnt

Solution

Any devices you attach on Linux (whether onboard or external ones) show up in /dev/. Specifically hard drives and other storage devices will show up as sdxY where x is the letter identifying the specific drive, and Y is the number of the partition if a drive has several. For example, sda3 is typically your main OS drive: sdA means it's the first hard drive in the list, and 3 is the / partition (after /boot and swap).

A USB drive you just connected will almost always be the last device in the list. So if you only have 1 hard drive, the USB will be sd*

You can find out which drive it is through this command listing all disk drives:

ls /dev/sd*

You can also list all hard drive partition via fdisk

fdisk -l
Mount the drive

Once you know which device it is, assuming you know the filesystem:

mount -t fat32 /dev/sdb1 /mnt

You can find out the filesystem from fdisk -l output.

Mount the drive as a non-root user

Running the mount command will give ownership of the drive to root accounts. So if you are NOT logged in as one, you need to add the -o argument to the mount command:

mount -t fat32 -o /dev/sdb1 /mnt


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 1626