Sunday, July 6, 2008

How to manually mount a USB Drive in Redhat

Inserting a USB storage device
  1. Plug in the device.
  2. Check the contents of the file /var/log/dmesg to see what the system named the device. (You can use the command dmesg as well.) It should appear as a SCSI device, so the name should be similar to /dev/sda or /dev/sdb.
  3. Use the command fdisk -l , replacing with the device name from /var/log/dmesg to determine the partitions on the device. Most USB flash drives and other portable storage media types have only one partition, so the output of the fdisk command will most likely be something like /dev/sda1 or /dev/sdb1.
  4. Create a directory (mkdir) to serve as the drive's mount point. It is recommended to use a name that is easy to remember like /mnt/usb.
  5. Mount the device with the mount command. If the device was detected as /dev/sda and the fdisk command showed /dev/sda1 as your partition, the command would be:
    mount /dev/sda1 /mnt/usb
    The mount command should automatically detect the partition type and mount the drive. It can be problematic to add the mount command to the file/etc/fstab, as the device may be detected with a different name if system devices are changed or if more than one USB device is plugged in at the same time. For this reason, it is recommended to mount the device manually with the full mount command listed above instead of relying on an entry in /etc/fstab.

13 comments:

Jane Anyanwu said...

Thanks for this post. it really helped me resolve a challenge. (I'm a newbie on Linux)

Basavraj said...

thanks yar..solve my problem

Anuj said...

Thanks it really help me out.....

Chris Bethel said...

being a newbie, how do you check the contents of the files?

Chris Bethel said...

nevermind i figured it out! thanks! this helped out.

really, all i needed to do was:

mkdir /mnt/usb
mount /dev/sda1 mnt/usb

cd /mnt/usb

ls -a

in order to see the files on the usb. thanks a bunch!

hjaltis said...

Thanks, solved my problem.

hjaltis said...

Thanks you solved my problem.

Bru said...

Thnks it was short and precise and instinctly got what I wanted to do.

Pasquale said...

{Shotgun approach, no checking dmesg:}
ls /mnt/usb
{If no files in there:}
umount /mnt/usb
mount /dev/sdb1 /mnt/usb

{To safely remove:}
udisks --unmount /dev/sdb1
udisks --detach /dev/sdb

{Note no numeral at end of 2nd command. This was tested under RedHat 6.4 as root}

Unknown said...

thanks a lot... it realy heped me

Unknown said...

dmesg showed as usbfs file system and device usbfs. I mounted it and also mounted but content showing 0 bytes and file names are not showing correctly. Is file system is to do anything with it.

mount -t usbfs /dev/usbfs /usb

[root@test ~]# cd /usb
[root@test usb]# ls -la
total 4
drwxr-xr-x. 6 root root 0 Sep 22 05:24 .
dr-xr-xr-x. 26 root root 4096 Sep 22 06:18 ..
dr-xr-xr-x. 2 root root 0 Sep 22 05:24 001
dr-xr-xr-x. 2 root root 0 Sep 22 05:24 002
dr-xr-xr-x. 2 root root 0 Sep 22 05:24 003
dr-xr-xr-x. 2 root root 0 Sep 22 05:24 004
-r--r--r--. 1 root root 0 Sep 22 05:24 devices

Robert said...

wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated 300W AC/DC Switching Adapter

Allen S. said...

What do you do when the USB Device is listed in fdisk -l but when trying to mount, linux states, Special device /dev/sdb4 does not exist?

Thanks, new to Linux here :-)