Look in the directory /dev/disk/by-id to see how your attached storage devices are mapped in /dev. If they are not already identified by UUID or Label, they will just get the next available letter in the alphabet. sda, sdb, then sdc, etc. The reason why you want to see them “by-id” is because if you plug in multiple devices in a different order one day, you may find what was “sdb3″ yesterday is “sdc3″ today.
# ls -l /dev/disk/by-id/ total 0 lrwxrwxrwx 1 root root 03-19 ata-SAMSUNG_HD80 -> ../../sda lrwxrwxrwx 1 root root 03-19 ata-SAMSUNG_HD80-part1 -> ../../sda1 lrwxrwxrwx 1 root root 03-19 ata-SAMSUNG_HD80-part2 -> ../../sda2 lrwxrwxrwx 1 root root 03-19 ata-SAMSUNG_HD80-part3 -> ../../sda3 lrwxrwxrwx 1 root root 03-19 ata-SAMSUNG_HD80-part4 -> ../../sda4 lrwxrwxrwx 1 root root 03-19 ata-SAMSUNG_HD80-part5 -> ../../sda5 lrwxrwxrwx 1 root root 03-19 scsi-36255a8ab200 -> ../../sdb lrwxrwxrwx 1 root root 03-19 scsi-36255a8ab200-part1 -> ../../sdb1 lrwxrwxrwx 1 root root 03-19 scsi-36255a8ab201 -> ../../sdc lrwxrwxrwx 1 root root 03-19 scsi-36255a8ab202 -> ../../sdd lrwxrwxrwx 1 root root 03-19 scsi-36255a8ab203 -> ../../sde lrwxrwxrwx 1 root root 03-19 scsi-36255a8ab204 -> ../../sdf
* Lookup the Universally Unique Identifier using the blkid command (part of e2fsprogs)
* The identifiers are generated when partitions are created. Non partitioned devices will not have these identifiers.
* Use of UUIDs are preferred over Labels since Labels are not unique. (labels such as “home”, “root”, “swap”, etc. are frequently used)
# blkid /dev/sda5: UUID="82176f36-a3cf-34c1-ae90-aa348e34733e" SEC_TYPE="ext2" TYPE="ext3" /dev/sda2: UUID="ab77293b-7f27-47bf-b74c-8374b27fb57b" SEC_TYPE="ext2" TYPE="ext3" /dev/sda1: UUID="f67c2297-44f5-4723-a279-b0740fcc8bf5" TYPE="ext2" /dev/sda3: TYPE="swap" UUID="a8b829a5-0bf1-4baf-adc7-d77adb7a7a46" /dev/sdb1: UUID="d75a72c8-ab7b-4f55-8757-6d912cca387a" SEC_TYPE="ext2" TYPE="ext3"
* include the noauto option to avoid auto-mounting this partition and ro for read-only just incase it is explicitly mounted
# grep d75a72c8-ab7b-4f55-8757-6d912cca387a /etc/fstab
UUID=d75a72c8-ab7b-4f55-8757-6d912cca387a /bad ext3 noauto,ro 0 0
* The UUID, as it is visible from any host, will not change. Once you know the identifier for the partition, you can modify the fstab on all hosts to avoid auto-mounting.
# ssh host2 echo UUID=d75a72c8-ab7b-4f55-8757-6d912cca387a /bad ext3 noauto,ro 0 0 >> /etc/fstab
Once you know which character device you’re looking for, you can also look in /dev/disk/by-uuid/ and find the uuid linked there.
# ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 03-19 82176f36-a3cf-34c1-ae90-aa348e34733e -> ../../sda5 lrwxrwxrwx 1 root root 03-19 ab77293b-7f27-47bf-b74c-8374b27fb57b -> ../../sda2 lrwxrwxrwx 1 root root 03-19 f67c2297-44f5-4723-a279-b0740fcc8bf5 -> ../../sda3 lrwxrwxrwx 1 root root 03-19 a8b829a5-0bf1-4baf-adc7-d77adb7a7a46 -> ../../sda1 lrwxrwxrwx 1 root root 03-19 d75a72c8-ab7b-4f55-8757-6d912cca387a -> ../../sdb1
If you copy partitions around using rsync, tar, or dd, then you will quickly find you have to edit /boot/grub/menu.lst and /etc/fstab if you’re using UUIDs everywhere.
In this case, the duplication of generic Labels is a good thing. I usually use the same layout of “BOOT”, “SWAP”, “ROOT”, and “HOME” labels for my 4 main partitions. Using label names with a partitions intended function is a good thing. I doubt you’ll ever want to mount SWAP in the kernel line of menu.lst and you’ll probably never find yourself using HOME as a label for swapon.
In these cases, labels are reusable even when the UUID may or may not have been changed.
# swapon LABEL=SWAP
title Fedora (2.6.26.6-49.fc8)
root (hd0,0)
kernel /vmlinuz-2.6.26.6-49.fc8 ro root=LABEL=ROOT vga=791
initrd /initrd-2.6.26.6-49.fc8.img
5:30 am
Над конечно отредактировать автоматически сделанный перевод. Полезно конечно о коменде blkid для начала вполне-вполне