techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 2655
Location: East Coast, West Coast? I know it's one of them.
Back to top
Posted: Apr 14, 09, 11:44    Creating Disk Labels in Linux
Here are the basic commands to create Labels to use instead of those awkward and user unfriendly UUIDs.

Make all labels very clear and specific, for example, if you computers name is mybox, a good safe label would be: mybox-root-1

It's very important that labels never conflict with each other or linux gets confused.

An external usb disk, for example, could be: usb-320gb-1

swap could be: mybox-swap-1

* swap: Create a new swapspace like this: mkswap -L <label> /dev/XXX
* ext2/ext3: e2label /dev/XXX <label>
* reiserfs: reiserfstune -l <label> /dev/XXX
* jfs: jfs_tune -L <label> /dev/XXX
* xfs: xfs_admin -L <label> /dev/XXX
* fat/vfat: There is no tool to change the label using Linux,
but when you create the filesystem, use mkdosfs -n <label> <other options>.
You may also change the label of an existing filesystem using Windows.
* ntfs: ntfslabel /dev/XXX <label< or change it using Windows.

Now, to update your system to use these, you'll need to edit, at least:

/boot/grub/menu.list Replace all /dev/sdxy or /dev/hdxy to use LABEL=<your partition label>

ie: root=/dev/sda1 becomes root=LABEL=mybox-root-1
or: root=UUID=YOERWTKJJSH873WHWY97ARWWERYE
becomes: root=LABEL=mybox-root-1

Hopefully no further examples of UUIDs totally userunfriendly character is required.

Do the same in /etc/fstab.

Note that if you for example have to reformat or expand or move a partition, you don't need to change any system that accesses that disk, all you need to do is make sure that partition receives the correct label, then linux will find it fine.

Other tests you can run to find hidden use of UUID or /dev/sdx:

:: Code ::
grep -REis '(/dev/[sh]d.*|UUID)' /etc/* | grep -Eiv '(binary|mtab|udev|bash|blkid|^#|^[[:space:]]*#|init.d|/rc)'
Display posts from previous:   

All times are GMT - 8 Hours