Wednesday, October 01, 2008
Mounting USB devices under Linux
For some reason, Ubuntu/Gnome often fails to mount properly USB drives when plugged-in. It is not hard to mount them manually, as long as user has super-user access and remembers necessary commands and options.
To mount anything, one has to know name of corresponding "device" file in "/dev"; under modern Linux, these are typically "/dev/sdc1", "/dev/sdd1", etc.
For some peculiar reason, there is no single utility which would print simple map "Name/manufacturer of USB disk => device file". Rather, there are four utilities which together allow user to accomplish this task:
- "lshw" is the only utility I know of which can print device names. To do that, run it like that:
sudo lshw -businfo | fgrep volume
- "lsusb" can print information about all USB devices (a lot of information with "-v"), including enough hints to identify specific device. It could be used both in "super user" mode and "regular user" mode;
- "fdisk -l" (super-user mode only) can print information about a device (if you have guessed its name).
- Finally, when you have figured out device name and file system type (FAT or NTFS), you run mount in super-user mode like that:
mount -t [vfat|ntfs] <device name, e.g. /dev/sdc1> <empty directory, e.g. /media/mydisk> -o \ rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush
Options can be adjusted, I believe above is what Gnome uses by default when mount is successful
[sudo] lsusb [-v] sudo fdisk -l /dev/sdc1 sudo lshw -businfo sudo mount -t [vfat|ntfs] /dev/sdc1 /lacie -o rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush
Labels: GNOME, linux, Ubuntu, USB