Glam Prestige Journal

Bright entertainment trends with youth appeal.

Is there a command to list all partition labels?

I can list the partitions with

sudo fdisk -l

but it doesn't show the labels of unmounted partitions.

1

3 Answers

sudo blkid -o list

lists all devices with labels:

device fs_type label mount point UUID
----------------------------------------------------------------------------------
/dev/sda1 ntfs WINRE_DRV (not mounted) 604C3A6A4C3A3B5C
/dev/sda2 vfat SYSTEM_DRV (not mounted) 6C3C-72E3
/dev/sda3 vfat LRS_ESP (not mounted) 5240-1BEE
/dev/sda5 ntfs Windows8_OS /media/Win8 A47A42FF7A42CDAC
/dev/sda6 ntfs Daten /media/Daten 72860971860936DF
1

Simply labels?

$ ls /dev/disk/by-label/
Download MuruHome Ubuntu Windows8 arch

Or better:

$ tree /dev/disk/by-label/ # or use ls -l
/dev/disk/by-label/
├── Download -> ../../sda6
├── MuruHome -> ../../sdc2
├── Ubuntu -> ../../sdc1
├── Windows8 -> ../../sda2
└── arch -> ../../sda1

If you're willing to use sudo (which blkid requires), then you could also use the lsblk command:

$ sudo lsblk -o NAME,LABEL
NAME LABEL
sda
├─sda1 System Reserved
├─sda2 windows
├─sda3 ubuntu
├─sda4
├─sda5 arch
├─sda6
│ └─lvmg-homelvm (dm-0) homelb
└─sda7
sdb
└─sdb1 └─lvmg-homelvm (dm-0) homelb
3

Use the command

lsblk -nPo MOUNTPOINT,UUID,LABEL 

You will get a list of fields that are most useful for your requirement.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy