[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: udev causing data loss?



On Saturday 15 November 2008, lee <lee@yun.yagibdah.de> wrote about 'Re: 
udev causing data loss?':
>On Sat, Nov 15, 2008 at 10:42:52AM -0700, ghe wrote:
>> At the time of my misadventure, I was still expecting sda to be the
>> lowest ID on the lowest SCSI bus -- there were no SATAs at the time,
>> not around here anyway.
>
>That is what I would expect. Are you saying that there is no way to
>tell which disk is which one from the device names?

Depends.  Stuff in /dev/disk/by-uuid has never lead me astray.  
However /dev/sd* nodes are named in the order the device is detected by 
the kernel.  It's not like that label is written to the disk.

I believe that disks on a single SCSI bus are always detected in order by 
increasing SCSI id.  However, /dev/sd* also includes USB and SATA devices, 
probably some others, too.  Devices are now probed asynchronously ("in 
parallel"; which makes the kernel boot faster), so the USB disk that you 
left in the system might be assigned a name before your SCSI bus.  Any of 
your two SCSI buses and one SATA bus could be assigned name(s) first and 
this could vary from boot to boot.

>If that is true, how does the user, how does the system know which
>disk is which one?

Well, the system assigns those names as it detects devices.  It gets some 
input from the user via their udev configuration.

>As user, I can eventually tell with fdisk -l and 
>looking at the info --- *if* the disks are all different. But how does
>the system figure out if the device refered to in /etc/fstab is
>actually the device that should be refered to?

The system has no notion of "should be".  The system uses the device name 
you list in /etc/fstab.  It's the administrator's responsibility to make 
sure that's what should be referred to.

Personally, I like using UUID= syntax to refer to my devices 
(/dev/disk/by-uuid doesn't list logical volumes), but it does make the 
lines in /etc/fstab a bit long.  The LABEL= syntax is also a good one.

>It seems I need to read up on this. Is there a good document that
>explains it?

You can start with man udev, then a quick google for "linux udev how-to", 
but I don't really know a definitive document.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss03@volumehost.net                      ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.org/                      \_/     

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: