Sunday, April 11, 2010

Mounting External USB Harddisk on Ubuntu

I connected an old external USB harddisk to my Ubuntu machine and found that it was not auto-mounting (sometimes these old USBs dont auto-mount). So, I had to mount it manually. Here are the steps I followed:

Step 1: Before plugging in the USB harddisk, check the available partitions on your system.

vinay@forest:~$ sudo fdisk -l

Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080

   Device Boot      Id  System
/dev/sda1   *       83  Linux
/dev/sda2            5  Extended
/dev/sda5           82  Linux swap / Solaris

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00003588

   Device Boot      Id  System
/dev/sdb1           fd  Linux raid autodetect

You can see that there are two partitions: /dev/sda (line number 3) and /dev/sdb (line number 13)

Step 2: Now plug in the USB harddisk and see which new partition shows up.

vinay@forest:~$ sudo fdisk -l

Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080

   Device Boot      Id  System
/dev/sda1   *       83  Linux
/dev/sda2            5  Extended
/dev/sda5           82  Linux swap / Solaris

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00003588

   Device Boot      Id  System
/dev/sdb1           fd  Linux raid autodetect

Disk /dev/sdc: 999.5 GB, 999501594624 bytes
255 heads, 63 sectors/track, 121515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0002ae3f

   Device Boot      Id  System
/dev/sdc1            7  HPFS/NTFS

You can see that:
1. /dev/sdc (line number 21) has now shown up. This is the USB harddisk partition.
2. /dev/sdc/ has HPFS/NTFS mentioned in the System column.

Step 3: Now that you know your USB harddisk partition (/dev/sdc in this case) and its type (HPFS/NTFS in this case), go ahead and mount it.

vinay@forest:~$ sudo mkdir /mnt/usbdrive
vinay@forest:~$ sudo mount -t ntfs /dev/sdc1 /mnt/usbdrive/

Thats it. You can now access your files from /mnt/usbdrive

To unmount:

vinay@forest:~$ sudo umount /mnt/usbdrive

2 comments: