Linux

How To Mount A USB Or Hard Drive In Linux

Posted by Weston Ganger on July 29, 2015

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:


Posted in Linux and Tagged with mount usb linux 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts