Colors of Noise

agx@sigxcpu.org

mount by label with Debian Installer
28th June 2008

The nice thing about d-i is that it's even more flexible then one thinks. Usually an autopartitioning recipe looks like:

500 10000 1000000 ext3
method{ format }
format{ }
use_filesystem{ }
filesystem{ ext3 }
mountpoint{ / } .

But what if you want a to set a filesystem label. That's easy:

500 10000 1000000 ext3
method{ format }
format{ }
use_filesystem{ }
label{ root }
filesystem{ ext3 }
mountpoint{ / } .

This sets the label root on the ext3 filesystem that will be mounted as /. You can set any variable here and the text between the curly braces ends up in $<partition>/<var> ready for partman to pick it up. See partman-auto-recipe for the full details.

The label allows to mount the filesystem by it's label instead of it's device name, so /etc/fstab looks like:

 LABEL=root /     ext3  defaults,errors=remount-ro,relatime 0 1
 LABEL=home /home ext3  defaults,relatime,user_xattr        0 2

Very handy if you insert partitions later which would change the numbering or work with partimage snapshots that should work on PATA and SATA. However this currently isn't supported by d-i since it can only create filesystem labels but can't write them to /etc/fstab. With the patches from #488321 and #488322 this can be done with:

500 10000 1000000 ext3
method{ format }
format{ }
use_filesystem{ }
label{ root }
labeled_mount{ }
filesystem{ ext3 }
mountpoint{ / } .

You also need to fixup mount since it will otherwise segfault during d-i's initial deboostrap run (#488312). Now support for labels on swap devides needs to be added to d-i.

Tags: debian.

RSS feed