Go to TogaWare.com Home Page.
GNU/Linux Desktop Survival Guide
by Graham Williams
Google

Mass Storage Devices


The standard Mass Storage Device protocol is used for USB devices such as hard disk drives, flash memory drives, memory card readers, and digital cameras. Such devices often have a standard VFAT (MS/Windows) file system but can be formatted as ext3.

The USB mass storage device is treated as a SCSI device so simply mount the SCSI device:

  # mount -t auto /dev/sda1 /mnt

You should now be able to see and use the device as any other disk. If you already have a SCSI device then the USB device might be /dev/sdb1 or /dev/sdc1, etc. Check the dmesg command to find out (probably mentioned in the last few lines after you plug the USB device in).

The kernel module usb-storage drives USB mass storage devices and should be automatically loaded by hotplug. The kernel module vfat is also required, and if it does not autoload then you will need to:

  # modprobe vfat

A sample setup of four USB devices includes a USB mouse, HP Printer/Scanner/Copier with a card reader, a digital camera, and a flash memory drive (3System USB flash disk). The /etc/fstab includes:

  /dev/sda1       /media/hpcard auto    rw,user,noauto  0 0
  /dev/sdb1       /media/camera auto    rw,user,noauto  0 0
  /dev/sdc1       /media/flash  auto    defaults,user,noauto 0 0

Then any user can mount, for example, /media/hpcard, when a memory card has been inserted into the card reader. A problem is that unless the camera is connected before the flash drive after a reboot, the mappings end up being reversed! A solution is to use udev as described in Chapter 64.

The devices look like any other hard drive device so you can run fdisk on it and reorganise partitions:

  # fdisk /dev/sdc

You can also format the partition(s) on the device with a DOS/FAT filesystem:

  $ mkfs -t vfat /dev/sdc1

To format the partition(s) on the device with a standard GNU/Linux ext3 filesystem:

  $ mkfs -t ext3 /dev/sdc1


Subsections

Copyright © 1995-2014 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.