View previous topic :: View next topic |
Author |
Message |
fikiz Apprentice
Joined: 07 Mar 2005 Posts: 282 Location: Italy
|
Posted: Wed Mar 09, 2016 9:40 am Post subject: Different device name for usb disks |
|
|
Hi all.
I just fu***d up my system writing an image file onto /dev/sda, just because one moment ago /dev/sda was the same usb drive on my Raspberry PI. #@!?£$@%(!$!"$@!!!!!!! I lost MBR, boot partition and one LVM logical volume; I'm still evaluating the damage size but this isn't (still) my question.
Is it possible to write an udev rule to name differently all usb storage devices? HDD, pendrives, enumerating their partitions too (possibly not usb dvd drives, /dev/sr0 is ok)? Could you help me to do that?
Thanks! |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Wed Mar 09, 2016 9:42 am Post subject: |
|
|
Those udev rules exist by default, have a look around in /dev/disk/.../...
For more descriptive names use labels, and partlabels (but have a care to give only unique label names) |
|
Back to top |
|
|
fikiz Apprentice
Joined: 07 Mar 2005 Posts: 282 Location: Italy
|
Posted: Wed Mar 09, 2016 9:51 am Post subject: |
|
|
I know, but I'm looking for something like:
/dev/usba = first usb drive
/dev/usbb = second usb drive
just like /dev/sda and /dev/sdb are first and second storage device. |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6069 Location: Removed by Neddy
|
Posted: Wed Mar 09, 2016 10:22 am Post subject: |
|
|
Its not as simple as that...
USB is a hotswappable and thus the default /dev label is provided based upon detection. aspects of the USB hub startup can easily re-order w.r.t. USB what physical device is assigned a node.
This is why udev rules exist to latch onto UUID to assign specific node labels to specific devices, independent of the detection order _________________ #define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0; |
|
Back to top |
|
|
fikiz Apprentice
Joined: 07 Mar 2005 Posts: 282 Location: Italy
|
Posted: Wed Mar 09, 2016 10:32 am Post subject: |
|
|
I understand.
I'll try to make a habit going deep into /dev/disk/... when I'm doing these kind of things.
Anyway, if anybody had an idea, I'm listening
Bye |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Wed Mar 09, 2016 12:54 pm Post subject: |
|
|
Quote: | A universally unique identifier (UUID) is an identifier standard used in software construction. A UUID is simply a 128-bit value. The meaning of each bit is defined by any of several variants. |
I think thats the reason why UUIDs exists
Well this issue exists since windi95 days.
When i do critical things i run parted to verify on which disc i do changes.
There is no guarantee on how devices are numbered |
|
Back to top |
|
|
|