11

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.

11

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
14
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
  • 2
    Exactly what I have been looking for! Thank you! – johann_ka Sep 20 '15 at 23:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.