USB stick automount

Published: Monday, Jun 30, 2008 Last modified: Thursday, Nov 14, 2024

No HAL and no D-BUS.

After plugging in my USB stick and looking at dmesg, I know my system has assigned it the /dev/sdb device.

x61:~% dmesg | grep sdb
[27912.676790] sd 3:0:0:0: [sdb] 7888896 512-byte hardware sectors (4039 MB)
[27912.677681] sd 3:0:0:0: [sdb] Write Protect is off
[27912.677691] sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00
[27912.677697] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[27912.680314] sd 3:0:0:0: [sdb] 7888896 512-byte hardware sectors (4039 MB)
[27912.680911] sd 3:0:0:0: [sdb] Write Protect is off
[27912.680920] sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00
[27912.680926] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[27912.680933]  sdb: sdb1
[27912.872951] sd 3:0:0:0: [sdb] Attached SCSI removable disk

Ok, lets find some extra information about it:

x61:~% udevinfo -n /dev/sdb -q all 
P: /block/sdb
N: sdb
S: disk/by-id/usb-Kingston_DataTraveler_2.0_2007062000000000591880AA-0:0
S: disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0
E: ID_VENDOR=Kingston
E: ID_MODEL=DataTraveler_2.0
E: ID_REVISION=1.00
E: ID_SERIAL=Kingston_DataTraveler_2.0_2007062000000000591880AA-0:0
E: ID_SERIAL_SHORT=2007062000000000591880AA
E: ID_TYPE=disk
E: ID_INSTANCE=0:0
E: ID_BUS=usb
E: ID_PATH=pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0

After Googling, I need to:

  1. Create a UDEV rule to symlink the device to /dev/usbstick