USB storage devices
This document describes how to use the popular USB memory sticks with Linux. However, it is also valid for other devices such as digital cameras that act as if they were just a USB storage.
Getting a kernel that supports usb_storage
If you do not use a custom-made kernel, you are ready to go, for all Arch Linux stock kernels are properly configured. If you do use a custom-made kernel, ensure it is compiled with SCSI-Support, SCSI-Disk-Support and usb_storage. If you use the latest udev, you may just plug your device in and the system will automatically load all necessary kernel modules. Older releases of udev would need hotplug installed too. Otherwise, you can do the same thing manually:
# modprobe usb-storage # modprobe sd_mod (only for non SCSI kernels)
Mounting USB memory
After inserting the stick you can mount the device as root with
# mount -t vfat /dev/sda1 /mnt/usbstick
Note: /dev/sda1 is variable. If your hard drive is assigned to /dev/sda1, you'll probably use /dev/sdb1 instead. To find out for sure where your USB device is, search dmesg for /dev/sd*. Use lsusb to verify that your USB device is indeed recognized by the system, if there is an error.
The -t flag specifies the filesystem type. If the device is formatted as fat32 then use the vfat parameter. By default an sdx device is assumed to be formated as fat32, so this option may be omitted.
Note: the directory you mount the stick into must exist before you issue the mount command.
Note: If you get an error message "Error org.freedesktop.DBus.Error.AccessDenied.", try adding your user account to the 'storage' group.
Repartitioning the USB memory
Sometimes the stick is separated in up to four partitions, and Linux can't read anything. To fix this you have to repartition the stick with
fdisk. Make sure that there are no files left on the stick (if you used it before in Windows, Mac OS or anywhere else). Type:
# modprobe usb_storage # fdisk /dev/sda
Delete all available partitions (d and partition number), create a new partition with n (I would suggest you use a single partition), press w to write everything and quit.
Create a filesystem on the stick:
# mkfs.vfat /dev/sda1
If you do not have mkfs.vfat on your system then use pacman to install dosfstools:
# pacman -Sy dosfstools
Now you can mount or unmount it as mentioned above.
Mounting the USB stick as normal user
If you want non-root users to be able to mount a USB memory stick, add the following line to your /etc/fstab file:
/dev/sda1 /mnt/usbstick vfat rw,noauto,async,user 0 0
'sda1' with the device name, which the USB disk will probably have.)
Now, any user can mount it with:
$ mount /mnt/usbstick
And unmount it with:
$ umount /mnt/usbstick