Traditionally, Linux on x86 hardware has used MSDOS partition tables. In this case, removing /dev/sda2
won't shift any of the higher numbered partitions down, because the primary partitions act like "slots": you can use them in any order you like, and removing one doesn't affect any of the others.
If instead you had sda{1-7}
with sda4
being the extended partition and sda{5-7}
being logical partitions within that extended partition, deleting sda6
would shift sda7
down. Logical partitions simply behave differently in this regard.
Newer versions of Linux are switching to GPT partition tables instead, though this is a slow process since there are limitations that prevent wholesale switching at this time.
In the GPT case, you don't need to use extended partitions to get more than 4 partitions on a single disk, and like MSDOS primary partitions, GPT partition numbers work like slots. You can delete a partition from the middle of a range and only leave a hole, with the existing partitions keeping their number. If you then create a new one, it fills the hole.
Your question asks about partition labels, however, and nothing I've talked about so far has anything to do with labels. Partition labels, in the sense used in Linux, are attributes of the filesystem, not the partition table. They exist to prevent changes to device names from causing problems with mounting filesystems. By using filesystem labels, you don't have to worry about device name changes because you're mounting partitions by label, not by device name. This is particularly helpful in cases like USB, where the device naming scheme is dynamic, and depends in part on what has been plugged in previously since the last reboot.
Linux mkfs.*
programs typically use the -L
flag to specify the label.
To mount a partition by label instead of by device name, use LABEL=mypartname
in the first column of /etc/fstab
. If you check your current /etc/fstab
, you'll probably find that there are already partitions being mounted that way. Linux GUI installers typically do this for you as a convenience.
You can mount a filesystem by label interactively, too, by passing the label with -L
to mount(8)
.
GPT does allow you to name a partition, but I don't know that it has anything to do with anything discussed above.
EDIT: One thing you do get with GPT which is relevant here, however, is a unique identifier for each partition, called a UUID. They work similarly to labels, but are different in several ways:
UUIDs are automatically assigned pseudorandom numbers, rather than a logical name you pick yourself.
You use -U
instead of -L
to mount(8)
a partition by UUID rather than by label.
You use UUID=big-ugly-hex-number
instead of LABEL=mynicelabel
in /etc/fstab
.
They are attributes of the partition, not the filesystem, so they will work with any filesystem as long as you can use GPT. A good example is a FAT32 partition on a USB stick: FAT32 doesn't have a filesystem label, and since it's on a USB stick you can't reliably predict which /dev/sd*
name it will get.
You should only share data partitions. Do not share any program partitions.
/home
is fine but avoid bin, dev, etc, usr, var, opt, and pretty much anything other than home.
As for the filesystem, it will have to be something both kernels have drivers for. I'm not sure how good BSD's ext support is, but Linux's UFS support is good enough, which means that you probably want to stick with UFS or MSDOS. The swap partition can be shared as long as both recognize the same partition type for swap (which I believe they do, but I am not certain).
And if you're sharing partitions between operating systems don't do anything like trying to run one in a VM from the other. Operating systems need to have exclusive control over filesystems. Two different running operating systems that thing they both have exclusive control over a partition will lead to corruption real fast.
Best Answer
With udev, You can use
to show the symlinks by label to at least some partition device nodes.
Not sure what the logic of inclusion is, possibly the existence of a label.