13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 5 ■ WORKING WITH FILESYSTEMS■ Note You can also do this the other way around, starting from the UUID to find the /dev/ reference:> findfs UUID=d40acb36-5f32-4832-bf1a-80c67833a618/dev/sda5Alternatively, use df to look at the devices you currently have mounted, and then look at/dev/disk/by_uuid/ to see how they match up:> ls -l /dev/disk/by-uuidtotal 0lrwxrwxrwx 1 root root 10 2008-10-13 13:41 178f2692-fef4-4485-b9c5-445c990b502e -> ../../sda2lrwxrwxrwx 1 root root 10 2008-10-13 13:41 5b67edaf-078d-4ac0-8b1b-f2119da85482 -> ../../sdb1lrwxrwxrwx 1 root root 10 2008-10-13 13:41 77cb9269-447a-45ce-b585-1c45ae3290bd -> ../../sda1lrwxrwxrwx 1 root root 10 2008-10-13 13:41 d40acb36-5f32-4832-bf1a-80c67833a618 -> ../../sda5Once you have the UUID of a device, you can use it in your /etc/fstab by putting UUID=uuid at thestart of the relevant line, instead of /dev/hdaX:UUID=d40acb36-5f32-4832-bf1a-80c67833a618 /local ext3 defaults 0 2A similar but more human-readable option is to give the disk a human-readable label using thetune2fs command:tune2fs -L localdata /dev/hda2Then edit /etc/fstab to use the label to mount the disk:LABEL=localdata /local ext3 defaults 0 2However, the advantage of using the UUID is that you can check what device name (for example,/dev/sda2) this is being translated to by looking at /dev/disk/by-uuid/ (see the earlier code snippet),whereas there’s no similar list by disk label.If you’ve cloned a disk, such as by using dd (see recipe 4-10), you might want to be able to mountboth the original and the clone at the same time. To make sure that the UUIDs don’t clash, first generatea new UUID, and then assign it to the new disk with tunefs:> uuidgen79fb806d-4350-4b8c-8bc3-f3bb0c6b56f2> tune2fs -U 79fb806d-4350-4b8c-8bc3-f3bb0c6b56f2 /dev/sdc1122Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!