Setting a Partition Label on Linux

This how to explains about setting partition labels on different filesystems.

Here some commands to set partition labels

For an ext2/ext3 partition use tune2fs or e2label, can be done on mounted filesystems:

$ sudo tune2fs -L ROOT /dev/sda1
$ sudo e2label /dev/sda1 ROOT

For a reiserfs partition, unmount filesystem before:

$ sudo reiserfstune -l HOME /dev/sda5

For a swap partition, unmount filesystem before:

$ sudo mkswap -L SWAP /dev/sda3

For a Windows NTFS partition you need ntfsprogs package:;

$ sudo ntfslabel /dev/sdb1 WINXP

Last one can be useful with external USB hard disk:

$ sudo ntfslabel /dev/sdb1 MY_PHOTOS

this way Ubuntu will mount it always with the same name on the same mount point, e.g. /media/MY_PHOTOS