My lsblk is not showing gpt partition label for one disk partition, which was freshly formatted with
mkfs.ext4 -v -L MyLabel mydev
- somehow the partition was not labeled properly afterwards. I didn't notice it until my mount-by-label operation failed.
- I tried to reset the partition label with
e2label, mount-by-label worked after that, butlsblkis still not showing the gpt partition label. - showing gpt partition label with
blkidworks.
So how can I have lsblk showing gpt partition label properly?
# As root,
# Here is the partition with working label
% blkid -s LABEL -o value /dev/sda9
os2
% lsblk -o NAME,LABEL /dev/sda9
NAME LABEL
sda9 os2
# Here is the partition without working label
% blkid -s LABEL -o value /dev/sda9
os2
% lsblk -o NAME,LABEL /dev/sda8
NAME LABEL
sda8
$ apt-cache policy util-linux
util-linux:
Installed: 2.36.1-8+deb11u1
Candidate: 2.36.1-8+deb11u1
Version table:
*** 2.36.1-8+deb11u1 500
500 http://deb.debian.org/debian bullseye/main amd64 Packages
500 http://security.debian.org/debian-security bullseye-security/main amd64 Packages
100 /var/lib/dpkg/status
e2labelsets thefilesystem label, which isn't the same asthe gpt partition labellsblkoutput. You could reboot, or just run fdisk/gdisk on the device and write (without making any changes of course) - oh and if you do want the gpt partition label, use gdiskcoption - and includePARTLABELfor thelsblk -ooptionPARTLABELinstead ofLABEL@JaromandaX !