1

I'm management a server that in /etc/fstab have references to some partitions using /dev/disk/by-id/DISK_ID-partN.

The server suddenly power-off and DISK_ID part of /dev/disk/by-id/DISK_ID-partN changed.

I always refer partition in /etc/fstab using UUID and will change the conf of fstab, but still I want know why the by-id change when tons of people on Internet said that such hard disk identifier don't change. Can partitions UUIDs change too (if so under what circumstances) or are UUIDs less "mutable" than by-id?

1 Answers1

1

The UUID of a partition is stored in the "header" of the filesystem structure - as in it is inside the partition data, not in the MBR or any other partitioning scheme. Long story short, it won't change unless you manually change it or reformat the whole partition.

The /dev/disk/by-id/ structure is, by definition, dependent on what ID the kernel gives to the device. That ID is generated by the kernel and not necessarily dependent on the hardware or the data contained therein, that's why it can change.

Luke404
  • 5,708
  • 3
  • 44
  • 58
  • Thanks @Luke404, googling one can found that info, but my question is: how is **/dev/disk/by-id/** is generated? or more precisely in what circumstances **by-id** could change? I hear that *OpenSuse* use **by-id** in its **fstab**, and my thinking is: if *OpenSuse* use **by-id**, then such mechanism to identify hd can't be so volatile. Anyway, my server change the id, but why? That server reboot several time and nothing happen, then without a hardware change (at least that I can see), it change that id (**by-id**) after a blackout. Thanks again. –  Jul 08 '13 at 18:49
  • 1
    @gsc-frank, these days almost everything under /dev is created by [udev](http://linux.die.net/man/8/udev). How udev operates is controlled by rules, which are not entirely consistent across various distributions. – Zoredache Jul 08 '13 at 20:27
  • @Zoredache Thanks! On Ubuntu >= 10.04 I don't see any rule related to *hd* under */etc/udev/rules.d/* so, Where can I learn about how udev determine/create the values that reside below *by-id*? Thanks again. I'm trying to understand what happened in my case and the general rule of operations regard by-id, so then I can justify in front colleague the decision to migrate from by-id base *fstab* to UUID –  Jul 08 '13 at 20:34
  • I don't have a 10.04 system handy. I know in later releases that most of the Ubuntu udev rules were migrated to `/lib/udev/rules.d`. The rules under `/etc/udev/rules.d/` are left for locally configured stuff. – Zoredache Jul 08 '13 at 20:41