[SOLVED] Re: labelling root file system (RELENG_8)

nickolasbug at gmail.com nickolasbug at gmail.com
Thu Jun 9 07:57:02 UTC 2011

2011/6/8 Josh Carroll <josh.carroll at gmail.com>:
>>> That would mean the only time a
>>> person can use tunefs on a root filesystem is when they either do it
>>> manually during the FreeBSD installation (adding "-t" to the list of
>>> newfs flags in the filesystem creation UI), or if they boot off of some
>>> other medium (USB flash drive, CD, PXE, etc.).
>> Or when your root fs is mounted r/o, which is not as bad as what you listed above.

Or when you've booted form device (not label), e.g. /dev/ada0s1a and
have set sysctl kern.geom.debugflags=16

> Perhaps I'm doing something wrong, but in my experience, at least with
> glabel, the label will not stick even if you have the root fs mounted
> ro. I have had to boot from an alternative media (boot cd, alternate
> root fs, etc) in order to create a label for the root fs with glabel.
> To be specific, I'm talking about the "automatic" labels created with
> glabel label <name> <dev>.
> I just tested this again in a VM, and sure enough if I boot single
> user mode but use ad0s1a as the ro root file system during single user
> mode, it still doesn't stick and upon reboot I don't have a /dev/label
> entry. Here is the exact sequence I used:
> 1. boot single user with the default root fs (ad0s1a).
> 2. leave / mounted read only
> 3. glabel label -v root ad0s1a   # reports successful addition of metadata
> 4. /dev/label/root exists as expected
> 5. reboot
> 6. /dev/label/root does not exist

You should mount fs from label device  - /dev/label/root in your case,
which must be in /etc/fstab, e.g.:
/dev/label/root    /    ufs   rw    1   1

Otherwise if you mount fs from device directly (not from label) label
entry (/dev/label/root) would be removed from /dev file system as
unused device. This action will be reported in dmesg (you may check

So, afrer labeling device you should add fstab record. After that you
can reboot.

More information about the freebsd-stable mailing list