USB Storage Device on Linux

From MobileRobots Research and Academic Customer Support

Jump to: navigation, search

To enable use of USB storage devices in the kernel, first load the usb_storage module. As root run:

modprobe usb_storage

This will load usb_storage and other modules needed to use USB storage devices. If you run dmesg you should see some new messages at the bottom as the kernel loads the modules and detects the USB device.

The new device will probably be called /dev/sda1, so you can mount it like this:

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

You can add an entry to /etc/fstab for /dev/sda1 so in the future you don't need to specify /dev/sda1:

/dev/sda1       /mnt/usb        auto    rw,user,sync,auto        0       0

Now you can just run

mount /mnt/usb

To mount the USB storage device.

(The "rw" option allows both reading and writing; the "user" option alows any user to mount the device; the "sync" option causes writes to happen immediately, so there is less chance of data being corrupted if you remove the USB device or it falls out before being explicitly unmounted; auto causes it to attempt to mount it at boot.)

You can also install autofs to automatically mount the device when plugged in, but this requires some setup etc. You can find out more about it on the web. (If you need packages for Debian 3.1 you can get them from archive.debian.org [1] -- Debian 3.1 is codenamed "sarge")

Personal tools