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

Re: udev causing data loss?



On Sat, 15 Nov 2008, Boyd Stephen Smith Jr. wrote:
> 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.

Correct.  And hotplug/unplug of SATA, SAS, SCSI, and even hotplug-enhanced
PATA will make your device go from sda (unplug+replug) to sde, for example.

> 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, 

Hot(un)plug will hose that.

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

The user starts using stuff like serial numbers or data written to the
storage media to identify it :-)

> 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.

Indeed. And /dev/sd* in /etc/fstab is NOT an intelligent thing to do with
today's hardware.

Note that /dev/md* is fine, since md arrays HAVE data stored inside them
that makes them go up in the desired place.

> 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.

Agreed.

> >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.

Nor do I, and we really should have this stuff well documented and widely
available.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: