tunefs -L labels don’t show up in /dev/ufs

I’ve had cases where

    tunefs -L IPKHIMGroot1 /dev/ada0p2

didn’t work. The label did not show up in /dev/ada0p3. After a reboot / could not be mounted from /dev/ufs/IPKHIMGroot1 because the label was still not there.

It dawned on me that I had written an image file into the partition file, but one that was shorter than the partition¬†(which works fine). I remember reading somewhere that the label is stored at the beginning and at the end, or just at the end of the filesystem. That’s also the place where gpart looks for it (which is no coincidence). If the filesystem does not cover the whole partition the label is not found during boot. The following commands made that work:

gpart resize /dev/ada0p2
growfs /dev/ada0p2
tunefs -L IPKHIMGroot1 /dev/ada0p2

Do remember kids: if it breaks your system, you get to keep the pieces.

Leave a Reply

Your email address will not be published. Required fields are marked *