You are not logged in.
Hi guys,
I have a following issue: sometimes it happens that my younger sister pulls out my usbstick, this causes that it becomes /dev/sdb instead of /dev/sda. The only solution I know to return usbstick to /dev/sda it to restart the computer. Do you know any other solution?
Offline
why must it be sda?
Offline
There's this udev trick:
http://wiki.archlinux.org/index.php/Ude … SB_devices
it looks like it will automaticly mount the device to /mnt/usbX . If that won't work you can always modify it to create a symlink from /mnt/usbX to /mnt/usb, or just mount any /dev/sdX to /mnt/usb .
Happy Hacking
Offline
Thanks man, it solved my problem. Great trick.
Offline
Hey, Hey, you're welcome. Thank you for inspiring me to play with udev.
Offline
I was wondering if it wouldn't be better to use pmount in instead of mount. It would allow unmounting by user.
Offline
Udev will unmount the drive when you remove it.
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /mnt/usb%n"
Offline
My question was connected to the fact that when I have an USB Drive (with buffer) some data might be still in buffer during removal. So it may cause data loss. To prevent that I'd prefer to umount drive before removal.
Offline
The sync and dirsync mount options would keep the drive unbuffered. If you remove those options you could always run the sync command as a normal user, then pull the device out. That or could run umount using sudo?
P.S. I don't know anything about pmount.
Offline
Ok. Thanks. I did not know about sync.
Offline