如何檢視Linux系統中的 LABEL/UUID
使用 blkid 命令:
用法(LABEL):
# blkid -s LABEL
/dev/hda3: LABEL="/"
/dev/hda1: LABEL="/boot1"
/dev/hda2: LABEL="SWAP-hda2"
/dev/hdc1: LABEL="/boot9"
/dev/hdc2: LABEL="/vm"
/dev/hdc3: LABEL="/home9"
/dev/hdc5: LABEL="/9"
/dev/hdc6: LABEL="/var/ftp/pub9"
/dev/hdc8: LABEL="/boot"
/dev/hdc9: LABEL="/1"
用法(UUID):
# blkid -s UUID
/dev/hda3: UUID="440612e0-9cea-4751-8e59-07ebffc589c2"
/dev/hda1: UUID="027ecc62-d346-411d-ae6c-c3eaa87fb195"
/dev/hdc1: UUID="fdbe6b52-755f-4e14-b970-b3be01543acc"
/dev/hdc2: UUID="e61f4197-5f00-4f4f-917c-290922a85339"
/dev/hdc3: UUID="06679282-4973-476a-98ae-4986f504816f"
/dev/hdc5: UUID="51f7e9a4-5154-4e29-a7a6-208417290b85"
/dev/hdc6: UUID="4bf4855e-96b9-43c4-89d7-b3d0087560e1"
/dev/hdc8: UUID="5a15d9d7-5a17-4d71-a2b6-eb978e6905cd"
/dev/hdc9: UUID="dc348785-9acb-4484-b52a-da000ffba601"
改變LABEL名稱:
e2label 裝置 新label,例如把 /dev/hda1 命名為 /boot:
e2label /dev/hda1 /boot
在mount 命令中使用 LABEL/UUID
mount LABEL=/boot1 /boot
mount UUID="51f7e9a4-5154-4e29-a7a6-208417290b85" /mnt/
在 /etc/fstab 中使用 LABEL/UUID
檔案/etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot1 /boot ext3 defaults 1 2
UUID="e61f4197-5f00-4f4f-917c-290922a85339" /usr ext3 defaults 1 12