e

** Pre-amble**

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.

** Create label using tune2fs**

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

** Create label using e2label **

Check existing label

e2label /dev/sda1
(eg)
partone

(and to change) 

e2label /dev/sda1 sexy


(re-check)
e2label /dev/sda1
sexy

** grub2 simple method **

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

oi41.tinypic.com_jhwvna.jpg



User Feedback

alsa_index
Did you find this article helpful?
Yes, right on the money!
 
24%(4)
Somewhat. Needs work.
 
41%(7)
Not really
0%(0)
Not at all.
 
35%(6)

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

 
grub2-label.txt · Last modified: 2012/01/13 21:59 by aus9 · [Old revisions]


© Copyright Bodhi Linux 2012. All Rights Reserved - Hosted by vaultnetworks