UFS Naming a new disc

MMacD

Active Member

Reaction score: 15
Messages: 121

A year or three ago, SirDice explained how to add a permanent human-readable label to a new disc that can be used in place of the ridiculously-mutable system-generated device identifier. I've searched for his explanation, but can't find it. Does anyone have a pointer to it?
 

usdmatt

Daemon

Reaction score: 514
Messages: 1,381

Personally I would use gpart to partition the disk and use gpt labels, especially if you are partitioning the disk anyway. This is part of the GPT spec and the label is stored in the partition table.

Code:
gpart create -s gpt adaX
gpart add -t freebsd-ufs -l mydisklabel adaX
newfs /dev/gpt/mydisklabel

You can also use glabel(), which is FreeBSD specific but allows you to label a disk without partitioning it (but can also be used on partitions).
 
OP
OP
MMacD

MMacD

Active Member

Reaction score: 15
Messages: 121

As I recall, his explanation was based on gpart, so I was expecting to use it. I would just plow ahead using, e.g., your example, but I seem to remember there was some trickiness involved. Unfortunately, at my age I'm lucky to be able to remember my cat's name, so "trickiness" is all I can remember about his explanation (well, that and that it involved gpart).
 

usdmatt

Daemon

Reaction score: 514
Messages: 1,381

Not sure what the trickiness could be. What do you want to do with the disk?
 
OP
OP
MMacD

MMacD

Active Member

Reaction score: 15
Messages: 121

It's a backup disc for my ZFS pools. I've 2, both 3-way mirrors, one on 4TB discs, the other on 1TB discs. Neither is anywhere near full yet, so I'm wondering whether I should create dedicated partitions for them on the backup disc and use the leftover space for backing up my non-ZFS storage or just allocate the whole disc in one lump and write the backups into subtrees for flexibility. Decisions decisions.

The trickiness may have had something to do with block sizes, or alignment.
 

usdmatt

Daemon

Reaction score: 514
Messages: 1,381

I would probably just create one partition, make a pool on it then send both backups to that.

You probably want 4k sectors (ZFS ashift=12) on the new disk if using ZFS on it. Should be automatic these days although there’s also a sysctl that can force it to 12.
 
Top