Friday, June 10, 2005

How to mount a USB drive in RedHat Linux 9.0 and its derivatives

If you are not using a nice distro like SimplyMepis (SimplyMEPIS/ubuntu) which does a windows style autodetect of USB drives you may have encountered issues mounting in other distros. There is supposed to be an auto detect feature in redhat that seemingly is hidden as far as I am concerned.

Thus, let me write out how I mount flash drives in linux:

Execute the following:
cat /proc/partitions

This will give you the sd+* location where the usb is mounted
Note: + is an alphabet, and * a number where the usb is mounted


Follow this by executing (as root)
cd /mnt
mkdir usb

mount /dev/sd+* /mnt/usb

Presto! You will have your usb flash drive mounted! Just do a
cd /mnt/usb

and you should be able to view all your files.


What do you do if you have two usb drives attached?

Simple:
Do the cat /proc/partitions to identify the locations where the usb drives are mounted

Follow this by (as root)
cd /mnt
mkdir usb1
mkdir usb2
mount /dev/sdab /mnt/usb1
mount /dev/sdxy /mnt/usb2

(ab and xy correspond to +* on sd+*)

(nothing prevents you from using directories already existent under /mnt. For example if you created a /mnt/usb directory earlier, you could use that)

You should be all set now! Hope this helps.

Other useful commands:
/sbin/fdisk -l [Execute as root]
dmesg grep -i "SCSI device"
lsusb

1 comment:

Anonymous said...

hi ..great blog!!! ... im new to linux ..im using redaht linux 9.0 ..i tried ur steps for mounting usb ..bt still havent succeeded ..can u help me out?