# UFS / glabel(8) not persistent across reboots?



## Christopher (Sep 23, 2010)

So I'm trying to setup ufs and glabels on a system for future use in /etc/fstab.  But for some reason they disapear after rebooting the system from single user mode.  

To create them, I boot the system into single user mode and run these commands:


```
boot -s
< snip kernel boot >
Enter full pathname of shell or RETURN for /bin/sh:
# tunefs -L rootfs /dev/da0s1a
# glabel label swap /dev/da0s1b
# ls -l /dev/ufs/
crw-r-----    1 root   operator         0,  92  Sep 22 17:31   rootfs
# ls -l /dev/label/
crw-r-----    1 root   operator         0,  83  Sep 22 17:31   swap
# shutdown -r now
```

After reboot, the labels seem to have gone away.


```
> ls -l /dev/ufs/
total 0
ls -l /dev/label/
total 0
```

I'm running a GENERIC 8.1 amd64 kernel, that appears to have GEOM_LABEL built in.


```
# uname -v
FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
```

Any ideas?


----------



## jb_fvwm2 (Sep 23, 2010)

I was able to set labels for 3 of 4 filesystems,
not root, (*maybe* the same problem as this one)
/dev/ufs/...
following or muddling through some guide(s).  
Three of four seems good enough for now.
Not that it helps you any, but maybe you want to
try setting it first in a non-root (/) filesystem
a number of ways. (label (tunefs) vs glabel vs...)
...
Though tunefs-only if it already has data AFAIK
...
for good measure, you might want to be sure
geom_mbr and geom_bsd are loaded.


----------



## wblock@ (Sep 23, 2010)

Christopher said:
			
		

> So I'm trying to setup ufs and glabels on a system for future use in /etc/fstab.  But for some reason they disapear after rebooting the system from single user mode.
> 
> To create them, I boot the system into single user mode and run these commands:
> 
> ...



I've seen it happen, but in my case I think it was from mounting the just-labeled filesystem r/w (actually, just pressing ctrl-d and letting it boot fully) instead of rebooting.  It's hard to track, because when I tried it again, it worked.


----------



## gordon@ (Sep 23, 2010)

The way geom works, it layers the label (rootfs) on top of the disk provider (da0s1a). If you mount the disk (da0s1a) it will "spoil" the label (rootfs) making it unavailable. It's a matter of faith to change your fstab to /dev/ufs/rootfs and reboot.


----------



## tab2tab (Oct 4, 2010)

im I'm trying to label an entire disk with label and i I have the same problem... any ideas?

http://forums.freebsd.org/showthread.php?p=104423


----------



## gordon@ (Oct 6, 2010)

tab2tab said:
			
		

> im I'm trying to label an entire disk with label and i I have the same problem... any ideas?
> 
> http://forums.freebsd.org/showthread.php?p=104423



Yes. First, use good grammar. =)

Second. Label the disk, change your fstab and reboot. Take it on faith. It. Will. Work.


----------



## Christopher (Oct 8, 2010)

gordon@ said:
			
		

> The way geom works, it layers the label (rootfs) on top of the disk provider (da0s1a). If you mount the disk (da0s1a) it will "spoil" the label (rootfs) making it unavailable. It's a matter of faith to change your fstab to /dev/ufs/rootfs and reboot.



Yep, your you're right, I just wanted to thank you for the hint.

I ended up booting a FreeBSD live usb drive and:

1.  Mount the rootfs on /mnt
2.  Update /mnt/etc/fstab
3.  Unmount /mnt
4.  tunefs -L to add a label
5.  Reboot with a sigh of relief when it booted normally


----------

