How To Mount A USB Or Hard Drive In Linux

Posted by Weston Ganger

Something that is handy to know in linux is how to mount and unmount drives from the command line.

We will discuss two methods.

First we need to find out what device we need to mount

sudo fdisk -l

Then find your device in the output, which should be something like /dev/sdb1

Now we get to the mounting part.

The first is the standard way of doing it but it requires root access:

# first create the mount point
sudo mkdir /media/external

# mount a FAT drive
sudo mount -t vfat /dev/sdb /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

# mount an NTFS drive (you may need to install the package ntfs-3g)
sudo mount -t ntfs-3g /dev/sdb1 /media/external

# unmount method #1
sudo umount /dev/sdb1

#unmount method #2
sudo umount /media/external

The Second method of mounting it is using pmount which doesnt require root access except to install pmount itself.

sudo apt-get install pmount

# to mount
pmount /dev/sdb1 your_label

# to unmount
pumount /dev/sdb

Related External Links:

Article Topic:Software Development - Linux

Date:July 29, 2015

Recommended Posts



Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected