How to mount a new drive into Linux OS

How to mount a new drive into Linux OS

July 23rd, 2009 // 10:40 pm @

If you are switching between Windows and Linux all the time or let say not that familiar with Linux mounting a new drive into your Linux Platform is one of the most important things to do that really comes handy specially if you doing Linux boot (Or any other Ubuntu distribution software).

Mounting

By default, storage devices that are plugged into the system mount automatically in the /media directory, open a file browser window for each volume and place an icon on your desktop. If you plug in a usb hard disk with many partitions, all of the partitions will automatically mount. This behaviour may not be what you want so you can configure it as shown below.

If the volumes have labels the icons will be named accordingly, otherwise they will be named “disk” and as more volumes are added, you can get “disk-1” and so on.

 

Manually Mounting

 

Get the Information

Sometimes devices don’t automount, in which case you should try to manually mount it. First, you must know what device we are dealing with and what filesystem it is formatted with. Most flash drives are FAT16 or FAT32 and most external hard disks are NTFS.

sudo fdisk -l

Create the Mount Poin

Now we need to create a mount point for the device, let's say we want to call it "external". You can call it whatever you want, just please don't use spaces in the name or it gets a little more complicated - use an underscore to separate words (like "my_external"). Create the mount point:
sudo mkdir /media/external

Mount the Drive

 

We can now mount the drive. Let’s say the device is /dev/sdb1, the filesystem is FAT16 or FAT32 (like it is for most USB flash drives), and we want to mount it at /media/external (having already created the mount point):

sudo mount -t vfat /dev/sdb1 /media/external -o uid=1000,gid=100,utf8,dmask=027,fmask=137

 

The options following the “-o” allow your user to have ownership of the drive, and the masks allow for extra security for file system permissions. If you don’t use those extra options you may not be able to read and write the drive with your regular username.

Otherwise if the device is formatted with NTFS, run:

sudo mount -t ntfs-3g /dev/sdb1 /media/external

Unmounting the Drive

 

When you are finished with the device, don’t forget to unmount the drive before disconnecting it. Assuming /dev/sdb1 mounted at /media/external, you can either unmount using the device or the mount point:

sudo umount /dev/sdb1

 

or:

sudo umount /media/external

 

Other Useful Commands

 

To see a list of your USB devices (the vendor and device ID’s), run:

lsusb

 

To see all attached storage devices and their partitions, run:

sudo fdisk -l

 

To see information about currently mounted systems, simply run:

mount

 

 

Never forget that Ubuntu platforms have this really usefull switch “–help”, se if you don’t know what comes next just use the help switch and Ubunto will give you all the available options.

 

I hope it was a usefull article.

 

 


Category : Linux &Tricks

Comments are closed.

On LinkedIn

LinkedIn

.

"I have no special talent.
I am only passionately
curious.
"
Albert Einstein

Subscribe Now