You are not logged in.

#1 2006-07-07 08:48:13

mdv
Member
From: Poland
Registered: 2005-04-09
Posts: 145

[solved] usbstick problem - how to make it /dev/sda

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

#2 2006-07-07 09:51:07

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: [solved] usbstick problem - how to make it /dev/sda

why must it be sda?

Offline

#3 2006-07-07 12:09:27

PenguinFlavored
Member
From: Chicago, IL, USA
Registered: 2006-06-06
Posts: 66
Website

Re: [solved] usbstick problem - how to make it /dev/sda

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

#4 2006-07-07 15:18:21

mdv
Member
From: Poland
Registered: 2005-04-09
Posts: 145

Re: [solved] usbstick problem - how to make it /dev/sda

Thanks man, it solved my problem. Great trick.

Offline

#5 2006-07-07 17:55:57

PenguinFlavored
Member
From: Chicago, IL, USA
Registered: 2006-06-06
Posts: 66
Website

Re: [solved] usbstick problem - how to make it /dev/sda

Hey, Hey, you're welcome. Thank you for inspiring me to play with udev.

Offline

#6 2006-07-11 16:08:38

mdv
Member
From: Poland
Registered: 2005-04-09
Posts: 145

Re: [solved] usbstick problem - how to make it /dev/sda

I was wondering if it wouldn't be better to use pmount in instead of mount. It would allow unmounting by user.

Offline

#7 2006-07-11 16:42:46

PenguinFlavored
Member
From: Chicago, IL, USA
Registered: 2006-06-06
Posts: 66
Website

Re: [solved] usbstick problem - how to make it /dev/sda

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

#8 2006-07-11 16:48:41

mdv
Member
From: Poland
Registered: 2005-04-09
Posts: 145

Re: [solved] usbstick problem - how to make it /dev/sda

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

#9 2006-07-11 17:09:26

PenguinFlavored
Member
From: Chicago, IL, USA
Registered: 2006-06-06
Posts: 66
Website

Re: [solved] usbstick problem - how to make it /dev/sda

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

#10 2006-07-11 17:13:55

mdv
Member
From: Poland
Registered: 2005-04-09
Posts: 145

Re: [solved] usbstick problem - how to make it /dev/sda

Ok. Thanks. I did not know about sync.

Offline

Board footer

Powered by FluxBB