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.