blkid command is a tool to display a UUID of block devices.
[ usage examples ]
Here’s /etc/fstab of my Fedora 16 machine.
convert UUID to device name
list UUID , file system type
see the detailed info of block device
edit /etc/fstab to mount /dev/sdb2 on a directory ( /var/Fedora16_USB_HDD ) when booting Fedora.
check UUID of /dev/sdb2
edit /etc/fstab. add a red line.
reboot Fedora16 to confirm /dev/sdb2 is mounted on /var/Fedora16_USB_HDD directory when booting.
after rebooting Fedora.
[ usage examples ]
Here’s /etc/fstab of my Fedora 16 machine.
# egrep -v ^# /etc/fstab | egrep -v ^$ UUID=ba2b7a10-73a2-4986-bcc5-964966fea960 / btrfs defaults 1 1 UUID=0f9153b2-3a0a-472c-8766-d0a37755cbef swap swap defaults 0 0 |
convert UUID to device name
[root@fc16 ~]# blkid -U ba2b7a10-73a2-4986-bcc5-964966fea960 /dev/sda1 [root@fc16 ~]# blkid -U 0f9153b2-3a0a-472c-8766-d0a37755cbef /dev/sda2 |
list UUID , file system type
[root@fc16 ~]# blkid /dev/sda1: UUID="ba2b7a10-73a2-4986-bcc5-964966fea960" UUID_SUB="d9f471c2-b4f9-400b-a604-aa0cb354b2b6" TYPE="btrfs" /dev/sda2: UUID="0f9153b2-3a0a-472c-8766-d0a37755cbef" TYPE="swap" /dev/sda5: UUID="eaf9e7cd-a2b7-4cb0-b589-ca3fb7f8c735" TYPE="swap" /dev/sda6: UUID="b3a1ec63-246c-4711-b0ba-b14584205b71" TYPE="ext4" /dev/sda7: UUID="5b301504-1784-418d-9c4f-1a48fdb37b22" TYPE="swap" /dev/sdb1: UUID="a8ad29b7-93d9-4fbd-8ae0-977d2dc3f2e8" TYPE="ext4" /dev/sdb2: UUID="7895c59c-8615-45bd-bb8d-164afb63dc26" UUID_SUB="f1271eaa-5dd2-44ab-9817-f72910ad50b0" TYPE="btrfs" |
see the detailed info of block device
[root@fc16 ~]# blkid -p /dev/sda1 /dev/sda1: UUID="ba2b7a10-73a2-4986-bcc5-964966fea960" UUID_SUB="d9f471c2-b4f9-400b-a604-aa0cb354b2b6" TYPE="btrfs" USAGE="filesystem" PART_ENTRY_SCHEME="dos" PART_ENTRY_TYPE="0x83" PART_ENTRY_FLAGS="0x80" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="286720000" PART_ENTRY_DISK="8:0" |
edit /etc/fstab to mount /dev/sdb2 on a directory ( /var/Fedora16_USB_HDD ) when booting Fedora.
check UUID of /dev/sdb2
[root@fc16 ~]# blkid /dev/sdb2 /dev/sdb2: UUID="7895c59c-8615-45bd-bb8d-164afb63dc26" UUID_SUB="f1271eaa-5dd2-44ab-9817-f72910ad50b0" TYPE="btrfs" |
edit /etc/fstab. add a red line.
[root@fc16 ~]# egrep -v ^# /etc/fstab UUID=ba2b7a10-73a2-4986-bcc5-964966fea960 / btrfs defaults 1 1 UUID=0f9153b2-3a0a-472c-8766-d0a37755cbef swap swap defaults 0 0 UUID=7895c59c-8615-45bd-bb8d-164afb63dc26 /var/Fedora16_USB_HDD btrfs defaults 0 0 |
reboot Fedora16 to confirm /dev/sdb2 is mounted on /var/Fedora16_USB_HDD directory when booting.
after rebooting Fedora.
[root@fc16 ~]# egrep sdb /etc/mtab /dev/sdb2 /var/Fedora16_USB_HDD btrfs rw,seclabel,relatime,nospace_cache 0 0 |
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.