Other Partition labels

I have noticed that labels created by gpart on FreeBSD do not correspond with Linux labels created by e2label.

Is there any way to create labels recognised universally?
 
gpart labels exist on the partition information, below the filesystem. I'm not sure that e2label creates them at the same level of the filesystem stack. Or probably not at the same location.
What are you trying to do?
Use freebsd gpart to partition and label a device and then use those labels in linux?
Partition and label in linux and use the labels in freebsd?
Does linux use their fdisk command to create a partition table on a device and is that compatible with the partition table created using gpart? In theory, according to the fdisk man page, it understands GPT.

Take a spare device, use FreeBSD gpart to partition it and label a partition.
Plug that device into a Linux system and then try
fdisk --list --output Name

You should be able to find the man page for Linux fdisk online
It looks like by default Linux partition does a disklabel type of "dos" so that could affect things like labeling.
 
I'm setting up a Ventoy multiboot disk and would like to identify which OS is on which partition. I currently have 15 partitions and am losing track of which OS is on which partition.

It looks like fdisk -x (on Void Linux) gives me some idea of what is installed where.

I now have around 6 different distributions of Linux, and am getting to hate Linux the more I use it. It's just a POS in different colours.
 
I've not used Ventoy so can't help with that.
My experience with Linux distributions is they fall into 2 camps roughly.
Debian based (Ubuntu is likely the most common one) or RedHat based (CentOS, Fedora).
The primary difference between all the different distributions is the Desktop Environment that is installed by default. That's it.

One doesn't need a completely new distribution for that, you can install whatever DE you want on any of them.
Kubuntu, Lubuntu, Budgie, Cinnamon all the other flavours are pretty much the same system, just a different default DE installed.
So you don't need a lot of different Linux distributions. Pick your major division (differences are getting smaller and smaller now), install the base desktop or server version, install your desired desktop.

The commands used to install or build packages are the other big difference; that becomes a matter of remembering which apt command is which dnf or yum command.
I use Ubuntu for work but my home systems are FreeBSD. If I had to run Linux for home I'd probably pick Debian, Arch or Void and install WindowMaker and make it look like my FreeBSD systems.
 
On linux, there is also the command "blkid" that may be more appropriate than fdisk or e2label
in the manpage for blkid, there is a weird reference to "/dev/disk/by-label", udev symlinks and /etc/blkid.conf
that may give some more clues.
 
As Mer already touched, you can find several label types.
There it can be a bit intimidating at first, so some overview bellow ;)

1. GPT partition labels - persistently stored at GPT (table)

FreeBSD
- you can list, create and edit them via gpart command
gpart show -l (for overview)
gpart add -l MyLabel device (when creating new partition)
gpart modify -l MyNewLabel device (modify existing)
- you can use it for mounting and operation with block device. Partition with label will appear as a device in /dev/gpt/.. (eg. /dev/gpt/MyNewLabel )

Linux
- you can create and modify them using gdisk command (which is also available in FreeBSD packages btw.)
- in Linux it's also called GPT partition name
- when in gdisk, you can interactively edit it via command c, and it's visible as a name in print partitions output - p
- similarly like in FreeBSD, you can use it for device access via /dev/disk/by-partlabel directory (eg. /dev/disk/by-partlabel/MyNewLabel )
- for quick interactive overview there is command lsblk, which is more suitable than blkid (rather aimed for probing of devices and querying of its specific attributes)
- lsblk -o +PARTLABEL will show you all devices in tree structure including partitions and its labels (you can make an alias for that)

2. Filesystem labels
- persistently stored at particular filesystem (usually in its superblock)
- metadata specific to fs type
- compared to GPT labels, those are not specific to GPT partition scheme and you can use it also on MBR or so
- operating system has to "understand" the fs to be able to use its labels
- this is label type you will likely encounter in GUI (desktop environments)
- for your cross-platform (FreeBSD / Linux) environment you can see and use only labels for FS supported at both OSes. Like UFS, ext2/3/4, NTFS, FAT16/32, iso9660 (data CD, DVDs), ZFS (when particular module is installed on Linux). FreeBSD won't show you labels for certain Linux specific FS like XFS, BTRFS.
- to alter FS label you always need to use specific tool for given FS.. eg. tune2fs for ext2/3/4, tunefs for UFS and so on..

FreeBSD
- FS labels currently used in your system will be visible via command: glabel status
it will show you also special device node under /dev, which you can use for access to the device with particular filesystem (like: /dev/ext2fs/MyLinuxPart )
more at man page for glabel

Linux
- FS labels are also visible via previously mentioned lsblk command with appropriate parameters
- if you join it with previous label type, you can use lsblk -f -o +PARTLABEL to have singular overview, which will show you both GPT labels and FS labels
- devices are accessible via /dev/disk/by-label/..

And bit special finally so called GEOM labels - those are specific to FreeBSD and compared to previous ones other OS will ignore it.
They have two flavors, temporary and persistent, you can manage them via glabel create, glabel label and glabel status commands. But most likely won't help you with your intended use case.
 
Back
Top