1

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, but lsblk is still not showing the gpt partition label.
  • showing gpt partition label with blkid works.

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

4
  • 2
    e2label sets the filesystem label, which isn't the same as the gpt partition label Commented Jul 7, 2023 at 5:25
  • 2
    also, after changing the filesystem label, it doesn't necessarily appear in lsblk output. 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 gdisk c option - and include PARTLABEL for the lsblk -o option Commented Jul 7, 2023 at 5:51
  • 1
    Yes, problem gone after reboot, which what I'll be doing next time, rather than trying to fix it before rebooting. thx! Commented Jul 7, 2023 at 17:42
  • 1
    Thanks so much for the hint about using PARTLABEL instead of LABEL @JaromandaX ! Commented Aug 21, 2023 at 16:06

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.