Created Saturday 10 November 2007 See: https://help.ubuntu.com/community/RenameUSBDrive
Under linux it is possible to refer a partition using its UUID or disk label, for example in /etc/fstab, or in the kernel command line for the root= parameter.
To refer to a disk with the label X, just write:
LABEL=X
And to refer to a disk with the UUID Y, write:
UUID=Y
To know what id the UUID or label of a partition, you can just use gnome-device-manager or a HAL commands like:
$ hal-find-by-property --key block.device --string /dev/sda3 /org/freedesktop/Hal/devices/volume_uuid_8ddeb97e_7a3b_42bc_888a_b17a87474ca7 $ hal-device volume_uuid_8ddeb97e_7a3b_42bc_888a_b17a87474ca7 | egrep 'volume\.(uuid|label)' volume.label = '/mnt/arch' (string) volume.uuid = '8ddeb97e-7a3b-42bc-888a-b17a87474ca7' (string)
To change the disklabel of an ext2 partition, just use the command line (as root):
e2label /dev/sda3 "NewLabel"
To see it, type:
e2label /dev/sda3
See: http://mtools.linux.lu/mtools.html
You can use the mlabel (from mtools) utility for FAT filesystems. To read a label, type as root:
mlabel -i /dev/sda1 -s ::
And to change the label:
mlabel -i /dev/sda1 ::Newlabel
Or interactively:
mlabel -i /dev/sda1 ::
Be careful, the label is always in uppercase.
Attention: you can't have two filesystems with the same labels. mlabel do not allow it.
If a file name in the filesystem has the same name as the label you want to assign, you will have to rename the file first. If you don't, mlabel will refuse to change the label.
A solution could be to recreate the swap using mkswap.