Saturday, May 22, 2010

How to Mounting an USB External Hardrive on Linux Machine

Here are few tips to mounting your external or USB hardrive:

after you plug your usb drive just type in your console

[code] [root@austin]# dmesg [/code]

then look at this following message



usb hd plugin

at this picture the device is detected as sdb1
then you should now that the device you need to mount is on /dev/sdb1

now create the directory that will be linked to the drive
[code] mkdir /mnt/usbdrive [/code]

now mount your drive to the directory that just created before:

[code] mount -t (your partition type) /dev/sdb1 /mnt/usbdrive [/code]

remember, you should know your partition type corectly before mounting

you can try to check with this command:

[code][root@austin]#fdisk -l
Disk /dev/hda: 240 heads, 63 sectors, 1940 cylinders
Units = cylinders of 15120 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda 1 286 2162128+ c Win95 FAT32 (LBA)
/dev/hda2 * 288 1940 12496680 5 Extended
/dev/hda5 288 289 15088+ 83 Linux
/dev/hda6 290 844 4195768+ 83 Linux
/dev/hda7 845 983 1050808+ 82 Linux swap
/dev/hda8 984 1816 6297448+ 83 Linux
/dev/hda9 1817 1940 937408+ 83 Linux
/dev/sdb1 1 2010 156301488+ 83 Linux [/code]

Various filesystem types like xiafs, ext2, ext3, reiserfs is using id 83
Some systems mistakenly assume that 83 must mean ext2.

example on linux partition:

[code] mount -t ext2 /dev/sdb1 /mnt/usbdrive [/code]


if you see some error you can try other types of partition id 83

[code] mount -t ext3 /dev/sdb1 /mnt/usbdrive [/code]

if you see this kind message.



that's mean you have succesfully mounting your external hardrive!
now you can move your file through your new mounting directiory /mnt/usbdrive



FYI: the name of windows partition in linux is Vfat aka FAT file system or ntfs
the name of usb flash disk partition is usbfs

No comments:

Post a Comment