TRY AT OWN RISK
All commands below use root powers unless specified. You can copy and paste by first running the command
sudo su
Firstly check what partition format you use as the label tools vary.
ext2/ext3/ext4 users can use e2label or tune2fs
Change the partition pathway to whatever, my examples assume you use /dev/sda1.
If you insert an USB drive or stick be careful you don't overwrite the wrong partition information please.
Reasons for using label in lieu of UUID include:
UUID is ugly to read and non-intuitive to trouble-shoot if boot errors
If you have multiple drives, there are no boundaries for your creativity with labels but UUID remain ugly.
One you have created a label it can be used at the command prompt for grub, if grub initially fails and you can't remember what /dev/sdx is.
Check existing label
tune2fs -l /dev/sda1 | grep name (eg) Filesystem volume name: partone
If you have no result or you want to create a label or overwrite the existing one try
tune2fs -L newlabelname /dev/sda1
Check existing label
e2label /dev/sda1 (eg) partone (and to change) e2label /dev/sda1 sexy (re-check) e2label /dev/sda1 sexy
Create a custom file as follows
open a text editor with root powers eg
sudo leafpad /etc/grub.d/40_custom
It should look like this for fresh install
#!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above.
now open a normal text editor at /boot/grub/grub.cfg and go to your main menuentry and copy and paste into the root text editor. ..below the last line in file your current boot menuentry
menuentry 'Bodhi Linux, with Linux 3.0.0-12-generic' --class bodhi --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 1e32c0ea-6027-40d9-8c88-6356fa5fce5c
linux /boot/vmlinuz-3.0.0-12-generic root=UUID=1e32c0ea-6027-40d9-8c88-6356fa5fce5c ro pcie_aspm=force nomodeset nouveau.modeset=0
initrd /boot/initrd.img-3.0.0-12-generic
}
Exit out of grub.cfg for the moment.
Edit your paste to remove the chaff and amend to label so it reads
menuentry 'Bodhi label' {
insmod ext2
set root=(hd0,1)
linux /boot/vmlinuz-3.0.0-12-generic root=LABEL=partone ro pcie_aspm=force nomodeset nouveau.modeset=0
initrd /boot/initrd.img-3.0.0-12-generic
}
The other bits of your kernel line are not discussed here. Change partone to your labelname please.
Save the file and exit root editor.
Now run
update-grub
Now check using non-root text editor grub.cfg to see if entry landed.
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Bodhi label' {
insmod ext2
set root=(hd0,1)
linux /boot/vmlinuz-3.0.0-12-generic root=LABEL=partone ro pcie_aspm=force nomodeset nouveau.modeset=0
initrd /boot/initrd.img-3.0.0-12-generic
}
### END /etc/grub.d/40_custom ###
now reboot to test
If you would like to comment or make further suggestions, please leave a note on our Comments page (you will have to Create an Account if you haven't already).
Original wiki by aus9