Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Different device name for usb disks
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
fikiz
Apprentice
Apprentice


Joined: 07 Mar 2005
Posts: 282
Location: Italy

PostPosted: Wed Mar 09, 2016 9:40 am    Post subject: Different device name for usb disks Reply with quote

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
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2971
Location: Germany

PostPosted: Wed Mar 09, 2016 9:42 am    Post subject: Reply with quote

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
View user's profile Send private message
fikiz
Apprentice
Apprentice


Joined: 07 Mar 2005
Posts: 282
Location: Italy

PostPosted: Wed Mar 09, 2016 9:51 am    Post subject: Reply with quote

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
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5710
Location: Removed by Neddy

PostPosted: Wed Mar 09, 2016 10:22 am    Post subject: Reply with quote

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
_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
fikiz
Apprentice
Apprentice


Joined: 07 Mar 2005
Posts: 282
Location: Italy

PostPosted: Wed Mar 09, 2016 10:32 am    Post subject: Reply with quote

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
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Wed Mar 09, 2016 12:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum