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.
- 1 Mounting USB devices
Mounting USB devices
If you have an up-to-date system with the standard Arch kernel and a modern Desktop Environment your device should just show up on your desktop, no need to open a console.
Otherwise see sections below.
Auto-mounting with udev
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)
First thing one need to access storage device is it's identifier assigned by kernel.
Using device node names ( /sd* )
This is the simplest way, but assigned name depends on order of insertion. Ways to get node name:
- search in the output of
dmesgfor the kernel device name, you can use
grepto help you find what you are looking for:
$ dmesg | egrep "sd[a-z]"
# fdisk -l
lists all available partition tables.
Every drive creates a UUID (Universally Unique Identifier), these identifiers can be used to track individual drive no matter their device node (ie
To find the current UUIDs execute:
# blkid -o list -c /dev/null
device fs_type label mount point UUID ------------------------------------------------------------------------------------------ /dev/sda1 ext2 /boot 7f4cef7e-7ee2-489a-b759-d52ba23b692c /dev/sda2 swap (not mounted) a807fff3-e89f-46d0-ab17-9b7ad3efa7b5 /dev/sda3 ext4 / 81917291-fd1a-4ffe-b95f-61c05cfba76f /dev/sda4 ext4 /home c4c23598-19fb-4562-892b-6fb18a09c7d3 /dev/sdb1 ext4 X2 /mnt/X1 4bf265f7-da17-4575-8758-acd40885617b /dev/sdc1 ext4 X1 /mnt/X2 4bf265f7-da17-4575-8758-acd40885617b /dev/sdd1 ext4 Y2 /mnt/Y2 8a976a06-3e56-476f-b73a-ea3cad41d915 /dev/sde1 ext4 Z2 /mnt/Z2 9d35eaae-983f-4eba-abc9-434ecd4da09c /dev/sdf1 ext4 Y1 /mnt/Y1 e2ec37a9-0689-46a8-a07b-0609ce2b7ea2 /dev/sdg1 ext4 Z1 /mnt/Z1 9fa239c1-720f-42e0-8aed-39cf53a743ed /dev/sdj1 ext4 RAPT (not mounted) a9ed7ecb-96ce-40fe-92fa-e07a532ed157 /dev/sdj2 swap <swap> 20826c74-eb6d-46f8-84d8-69b933a4bf3f
At this point you should see a list of your system drives and a long strings of characters. These long strings are the uuids.
- Now connect your USB device and wait for a few seconds . . .
blkid -o list -c /dev/null
Notice a new device and UUID? That is your USB storage
blkiddoes not work as expected, You can look for the UUIDs in
$ ls -lF /dev/disk/by-uuid/
Mounting USB memory
You need to create the directory in which you are going to mount the device:
# mkdir /mnt/usbstick
Mount the device as root with this command (do not forget to replace device_node by the path you found):
# mount device_node /mnt/usbstick
# mount -U UUID /mnt/usbstick
mount does not recognized the format of the device you can try to use the
-t argument, see
man mount for details.
As normal user with mount
If you want non-root users to be able to write to the USB stick, you can issue the following command:
$ sudo mount -o gid=users,fmask=113,dmask=002 /dev/sda1 /mnt/usbstick
As normal user with fstab
If you want non-root users to be able to mount a USB memory stick via fstab, add the following line to your
/dev/sda1 /mnt/usbstick vfat user,noauto,noatime,flush 0 0
UUID=E8F1-5438 /mnt/usbstick vfat user,noauto,noatime,flush 0 0
(see description of user and other options in the main article)
/dev/sda1is replaced with the path to your own usbstick, see Mounting USB memory.
Now, any user can mount it with:
$ mount /mnt/usbstick
And unmount it with:
$ umount /mnt/usbstick