What exactly are `disklabels` and how do they differ from disk partitions? [bsdlabels] [disklabels] [labels] [partitions] [disk management] [OpenBSD] [Question] reddit / BSD ---------------------------------------------------------------------- MrRichBOB · 2021-03-03 04:54 ANSWERED - - - - I am a little familiar with FreeBSD, but I am growing more familiar with OpenBSD as I have been playing around with it for the past few days and shall continue to do so well into the future, in no small part thanks to the amazing book by M.W. Lucas and all of the _actual_ man pages that do their job. It probably isn't pertinent, but I am at the point wher I am fairly comfortable now to mess around a little in `/etc`, manager users, and install and use software (basic desktop use). That said, I am not good at all when it comes to disk management in anything other than GNU/Linux. It is very logical, the tools are logical (namely GNU `fdisk`), and I am sure BSD systems are just as easy just a bit different. That all said, what are disklabels? in particular when talking about OpenBSD. I assume FreeBSD's BSDLabels are the same. I know a _disk label_ or _partition label_ is a virtual stickynote on the front of a filing cabinet, I get that. But, when I use `fdisk sd0` to view my drives on my OBSD test machines, the output appears to only show 4 partitions and using `disklabel -p G sd0` outputs all of the disk labels. The thing that made me realise that there is something a bit different is that disklabel `c` is for the entire disk (IIRC, this is the label for the MBR). What are these? how can I think of these? Is it two different partition tables--one for the BIOS and one for the actual OS? Thank you for your time--I know I am very wordy. ---------------------------------------------------------------------- frenchiephish · 2021-03-03 05:35 Disklabel is an alternative partitioning scheme (think GPT vs MBR) (and yes bsdlabel is synonymous). https://en.m.wikipedia.org/wiki/BSD_disklabel Historically IBM compatible machines expected an MBR partitioning scheme, so for compatibility on that platform disklabel was often nested under an MBR partition (whole disk, unless multi-booting). The bios could see the partition (and it's boot sector) and then the kernel could read the disklabel after that. Other machines were able to understand disklabel natively. When nesting under MBR, the MBR partitions were referred to as slices, the disklabel partitions as partitions. You might still encounter MBR disks which present as /dev/da0s1 rather than da0p1 for instance. Disklabel has features that are more sophisticated than MBR hence the reason for nesting it and using it rather than just using straight MBR partitions. These days, unless there is very good reason not to, you should probably be provisioning GPT which is an improvement on both schemes. ---------------------------------------------------------------------- MrRichBOB · 2021-03-03 06:04 Thank you, that is exactly what I needed to know. ---------------------------------------------------------------------- FUZxxl · 2021-03-03 11:14 Reddit doesn't have tags. Don't put pseudo-tags in the title. ---------------------------------------------------------------------- bikojo1133 · 2021-03-03 12:12 It’s the internet, people can do what they want. ---------------------------------------------------------------------- dannomac · 2021-03-03 15:19 I really hate doing this, but [non-mobile Wikipedia link](https://en.wikipedia.org/wiki/BSD_disklabel) ---------------------------------------------------------------------- istarian · 2021-03-03 17:07 That said, it's better to have a few than a lot... > ... [Question][OpenBSD][disklabels] The above would make more sense. ---------------------------------------------------------------------- istarian · 2021-03-03 17:10 It does have *flair* which is sort of tag-like, though. Using flair to indicate that it's a question and which *BSD it's about would be useful. ---------------------------------------------------------------------- MrRichBOB · 2021-03-03 17:57 It's easier to search in the internet, I normally only put three or four but I felt this number would be better. ---------------------------------------------------------------------- frenchiephish · 2021-03-04 02:59 Cheers, didn't think to clean it up but should have. ---------------------------------------------------------------------- Kernigh · 2021-03-04 04:36 Yes, you have two different partition tables. OpenBSD uses its disklabel to subdivide a single MBR (or GPT) partition into multiple BSD partitions. Other BSDs might just use GPT without a disklabel. The v0 disklabel only fits disks [smaller than 2 terabytes = 2\*\*40 b ytes](https://www.freebsd.org/cgi/man.cgi?query=disklabel#COMPATIBILIT Y). Today, disks can be too big, so the v0 label is obsolete. OpenBSD has its own [v1 disklabel](https://github.com/openbsd/src/commit/ddfcb f38c8ab6225a6b172d829aa957007d2587f) to allow larger disks. When you install OpenBSD, it will put a v1 label on the disk. The BSD disklabel has 3 odd features: 1. Partition `c` is always the entire disk. (You can have at most 15 partitions, from `a` to `p` not counting `c`.) MBR and GPT don't have a special partition for the entire disk. 2. If the disk is bootable, partition `a` must be root, and `b` must be swap. MBR and GPT don't have this rule. 3. The label also stores the block size (bsize) and fragment size (fsize) of each 4.2BSD partition. MBR and GPT don't store the bsize and fsize. ---------------------------------------------------------------------- MrRichBOB · 2021-03-04 04:54 Thank you for your extra clarification. And yes, that is what MWL's book _Absolute OpenBSD_ said about manually partitioning drives: “`/` must always be first and `swap` must always be second.” But, it is good to know it is a quirk and not a 'best practice'. The way it was worded sounded like a 'best practice' to me. (of course if it were, I have always theorised that important or frequently read data should go first on the storage drive to improve speed, and his book as well as comment and thoughts from other sysadmins have corroborated this to me.) ---------------------------------------------------------------------- dannomac · 2021-03-04 16:35 No worries. We all do it. ---------------------------------------------------------------------- euphraties247 · 2021-03-16 02:01 The VAX didn't have any concept of partitions as we know them. The 'partitions' were compiled into the kernel for known offsets of known disks. If you had a new disk type you had to edit the kernel and rebuild. Just as you wanted a larger swap space? rebuild. More room for users? rebuild. Label's took care of this to make it dynamic. You can find ancient postsings in usenet where people would add in new disk definition files, as new disk types were available to the industry. Obviously things like SCSI and then IDE would change all this where you can actually just ask the disk how big it is. The real fun comes from measuring disk speeds, and using interleaving which when done correctly can dramatically speed things up, although if done wrong can make things incredibly slow. Obviously in the world of SSD's (NVMe) the placement of data doesn't matter in the slightest with regard to physical head access. ---------------------------------------------------------------------- MrRichBOB · 2021-03-16 02:49 Thank you for the detailed and interesting reply (not copied and pasted from a business website.) SSD's, of course, store the data sequentially resulting in it being scattered across the chips. 100,1,103,140,1000,20000,3, etc. So I assume that they have a way of keeping data straightened out, but this is why data placement on them, of course, is unimportant, but as you said on disks it is important. But one thing that took me by surprise (and perhaps SSD's have changed since then) is that according M.W. Lucas, if you do not partition an entire SSD but leave some or most unallocated, it improves speeds and lengthens the life of the drive because every chip is not constantly being written over and read.