Linux下查看硬盘分区UUID和LABEL

有多种方式实现,贴下最简明的两种:

  • 使用blkid命令进行查看:
[[email protected] ~]# blkid 
/dev/block/8:20: LABEL="root" UUID="ed5eed04-5740-42c9-92f2-e38f284791c4" TYPE="ext4" PARTUUID="4b0f24a9-400e-4e29-986d-401ca003f09e" 
/dev/block/8:18: LABEL="boot" UUID="51525974-89d2-4abd-a9b3-e2889b222de0" TYPE="ext4" PARTUUID="6dff7190-b287-42fb-82a4-48c1ae91f4c0" 
/dev/block/8:17: SEC_TYPE="msdos" LABEL="UEFI" UUID="7B0C-F457" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="26b3a86d-e30d-4fbc-9652-636f4f800262" 
/dev/block/8:19: LABEL="swap" UUID="8d1c5239-364a-440a-82f9-df3630fcc822" TYPE="swap" PARTUUID="d05972a7-bb88-4be7-a461-1611e99f15df" 
/dev/sda1: LABEL="data" UUID="d808878d-b1a7-4abe-9ab4-25f8d744f966" TYPE="ext4"
  • 使用ls查看/dev/disk下面的影射:
[[email protected] ~]# ll /dev/disk/by-uuid/
total 0
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 51525974-89d2-4abd-a9b3-e2889b222de0 -> ../../sdb2
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 7B0C-F457 -> ../../sdb1
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 8d1c5239-364a-440a-82f9-df3630fcc822 -> ../../sdb3
lrwxrwxrwx. 1 root root 10 2017/03/09 00:35:50 d808878d-b1a7-4abe-9ab4-25f8d744f966 -> ../../sda1
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 ed5eed04-5740-42c9-92f2-e38f284791c4 -> ../../sdb4
[[email protected] ~]# ll /dev/disk/by-label/
total 0
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 boot -> ../../sdb2
lrwxrwxrwx. 1 root root 10 2017/03/09 00:35:50 data -> ../../sda1
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 root -> ../../sdb4
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 swap -> ../../sdb3
lrwxrwxrwx. 1 root root 10 2017/03/08 23:50:49 UEFI -> ../../sdb1

 

留下评论

error: Content is protected !!