I hate to bitch but bitch I must

Vincent Hoffman vince at unsane.co.uk
Sat Oct 17 22:17:32 UTC 2009


PJ wrote:
> michael wrote:
>   
>> PJ wrote:
>>     
>>> Why is it that the manual pages, as thorough as they may be, are very,
>>> very confusing.
>>> Perhaps I am being too wary, but I find that too many
>>> instructions/examples are stumbling blocks to appreciation of the whole
>>> system:
>>> for instance, let's look at the instructions for changing disk labels
>>> with glabel or is it tunefs ?
>>> man glabel(8):
>>>
>>> for UFS the file system label is set with
>>> tunefs(8)
>>> <http://www.freebsd.org/cgi/man.cgi?query=tunefs&sektion=8&apropos=0&manpath=FreeBSD+7.2-RELEASE>.
>>>
>>> what happened to glabel?
>>> man tunefs(8)
>>> The *tunefs* utility cannot be
>>> run on an active file system. To change an active file system, it must
>>> be downgraded to read-only or unmounted.
>>>
>>> So, you have to run tunefs from an active file system to modify another
>>> disk?
>>> but from man tunefs:
>>> BUGS
>>> This utility should work on active file systems.
>>> What in hades does this mean--just above it says cannot be run on active
>>> file systems. ???
>>>  To change the root file
>>> system, the system must be rebooted after the file system is tuned.
>>>
>>> You can tune a file system, but you cannot tune a fish.
>>> How cute... And fish eat bugs.
>>>
>>> Seriously, now to the manual:
>>> To create a permanent label for a UFS2 file system without destroying
>>> any data, issue the following command:
>>> # tunefs -L /home/ /dev/da3
>>>
>>> Oh? home is what? What does this have to do with the partitions?
>>> Here's from man glabel(8):
>>>
>>> EXAMPLES
>>> The following example shows how to set up a label for disk ``da2'', cre-
>>> ate a file system on it, and mount it:
>>> glabel label -v usr /dev/da2
>>> newfs /dev/label/usr
>>> mount /dev/label/usr /usr
>>> [...]
>>> umount /usr
>>> glabel stop usr
>>> glabel unload
>>>
>>> The next example shows how to set up a label for a UFS file system:
>>> tunefs -L data /dev/da4s1a
>>> mount /dev/ufs/data /mnt/data
>>>
>>> Am I to understand that glabel is only for a new system? What's with the
>>> newfs... I'm trying to set labels on an system that is already set up.
>>> And, the glabel examle above is not for UFS file systems? Oh, that's for
>>> tunefs?
>>> So why are we even dealing with this glabel?
>>>
>>> from manual:
>>> # tunefs -L /home/ //dev/da3/
>>> A label should now exist in /dev/ufs which may be added to /etc/fstab:
>>> /dev/ufs/home /home ufs rw 2 2
>>>
>>> Why? Is this necessary? and somewhere I saw "tunefs -L volume
>>> /dev/da0s1a" or something like that. Does that mean that each partition
>>> should be tunefsd? Maybe the guys who programmed this stuff understand;
>>> I sure don't. I just want to be able to set the labels according to what
>>> they say can be done... so shy not have a clear and concise explanation?
>>>
>>> Do people who write this stuff ever read it? Tell me that its clear and
>>> simple and to the point... so far, I have been running back and forth
>>> between half a dozen web pages trying to understand what is going
>>> on... and doing things through a dense fog does not produce creative
>>> results!
>>> _______________________________________________
>>> freebsd-questions at freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>>> To unsubscribe, send any mail to
>>> "freebsd-questions-unsubscribe at freebsd.org"
>>>   
>>>       
>> ok, in short since i didn't see anyone answer this directly, your
>> question of tunefs vs glabel:
>>
>> tunefs is for UFS: it labels a UFS filesystem, no matter the device,
>> ie: ad or da. tunefs is part of the filesystem utilities for UFS.
>> good example, can't tunefs -L SWAP /dev/ad0s1b if it is a swap. you
>> can glabel it.
>>
>> glabel is for labeling a device itself. you can glabel an ntfs
>> filesystem or ext2, whatever.
>>
>>
>>     
> Thanks for that, Michael.
> But can you explain what this means? It just is not clear for me.
> "# tu;nefs -L home /dev/da3"
> This puts a label on that disk? So now it can be referred to as home?
> da3 = home ?
>
>   
yes. this makes a ufs label which you can access via /dev/ufs
for example (my home system)
jhary at ostracod
(23:08:34 <~>) 0 $ ls /dev/ufs
SCRATCH         SSDROOT         SSDUSR          SSDVAR
jhary at ostracod
(23:08:39 <~>) 0 $ mount
/dev/ufs/SSDROOT on / (ufs, local, noatime)
devfs on /dev (devfs, local, multilabel)
/dev/ufs/SSDUSR on /usr (ufs, local, noatime, soft-updates)
/dev/ufs/SSDVAR on /var (ufs, local, noatime, soft-updates)
/dev/ufs/SCRATCH on /scratch (ufs, local, noatime, gjournal)
tmpfs on /tmp (tmpfs, local)
devfs on /var/named/dev (devfs, local, multilabel)
jhary at ostracod
(23:08:41 <~>) 0 $ cat /etc/fstab
/dev/ufs/SSDROOT        /       ufs     rw,noatime      1       1
/dev/ufs/SSDUSR /usr    ufs     rw,noatime      2       2
/dev/ufs/SSDVAR /var    ufs     rw,noatime      2       2
/dev/label/SWAP none    swap    sw      0       0
/dev/ufs/SCRATCH        /scratch        ufs     rw,noatime      2       2
tmpfs           /tmp    tmpfs   rw      0       0

note there I have also used glabel on the swap (command used was glabel
label /dev/ad10p1)
One thing to note with label, if you mount/use the device by is raw
node, the label disapears.
ie:
[root at ostracod ~]# swapoff -a
swapoff: removing /dev/label/SWAP as swap device
[root at ostracod ~]# swapon /dev/ad10p1
[root at ostracod ~]# ls /dev/label/
[root at ostracod ~]# swapoff /dev/ad10p1
[root at ostracod ~]# ls /dev/label/
SWAP
[root at ostracod ~]# swapon -a
swapon: adding /dev/label/SWAP as swap device

This used to confuse me greatly :)

Vince

> I'll try to delve into the man glabel further... but things still look
> murky.
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>   



More information about the freebsd-questions mailing list