How to Change Linux Partition Label Names on EXT4 / EXT3 / EXT2 and Swap. Let’s see Linux disk partition tutorial.
A Partition is a space chiseled out from a natural disk which can be used to either install an Operating System or just act as a cache space for Users files and other data. Each partition is generated directly on Hard Disk or External Disk attached to the system with a beginning and ending block address diagnose the amount of space it takes on the drive.
Although you can create n number of barrier you ambition a Linux system describe a maximum of 16 partitions which can be correlated to any of SCSI, SATA, PATA or virtual hard disk. For diagnosing above partitions, A Linux system has its own natural convention. That convention is in the form or
‘/dev/vdxn‘ where are
‘x‘ alphabet and a
'/dev' is the directory in
'/' a file system which holds files associated to each of the gadget added to a Linux system. After that
's' identifies an SATA, SCSI or PATA drive and
'v' is for implicit disks on KVM based Machines. The later alphabet i.e.
'd' is an acronym for a device and finally, the next alphabet identifies the drive attached.
If your rule has 4 hard disks, you may boast listing for:
/dev/sdd in the output of fdisk ultimatum when ‘l’ option is invoked.
After the alphabet comes the number. A symbolic hard disk identifies 4 primary partitions of which there can be an continue partition too, which again holds multiple logical partitions. In that case, the first primary partition, which generally is the boot partition, grip the default label:
'/dev/sda1' which add up to its position as a first constitutional partition on a first hard disk, likewise will
'/dev/sdb1' be a first primary partition on a second hard disk.
The next primary partition will have sda2, then sda3 and so on, with logical partition starting from sda5. This is a just of how a Linux barrier is laid down, although directly one more type of partition exists, which is Linux LVM partition on which coherent Volume is composed out of natural Volume and Volume Groups on the fly without directly affecting the underlying hardware.
Linux Filesystem and Partitions – Types and Terminologies
A bare Linux system constructs 2 partitions during typical installation i.e. root
('/') (Where the filesystem is laid down) and swap (a temporary cache space which is fictitious to be twice of RAM by default which is even if not necessary).
The bootloader is roughly installed in the root partition or the first basic partition. Partition lays down the base for filesystems which are then composed on the partition, but before that, it needs the partition to be formative for the type of filesystem to be promoted on that partition.
Some of the filesystems supported by Linux Systems include:
Some Terminologies Relating to Linux Partitioning:
Precisely holds area on hard disk detailed in terms of first and last sector address and assets a label indicating the hard disk where it is and its number. It can hold the boot folders for OS or the data as configured by an end user.
After first 4 primary partitions, come the logical partitions what are laid down on a protracted partition. These are universally used to hold the filesystem as spread down by a user. Swap space is also configured as a logical partition.
Linux LVM Partition:
LVM partition is used for temporal down filesystems created on Logical Volumes. LVM is a composition for Logical Volume Management, a feature of Linux to modify on the fly Logical Volumes on partitions. It took a partition, which then holds a natural Volume and multiple natural volumes are mixed to create a volume group on that Logical Volume is laid down. Logical Volume is then preformatted to hold the filesystem.
A formatted portion of space, which can hold filesystem. Volume is helped on the partition for a mounting filesystem on it and conceded it to hold user data.
Because all the operations on partitions need modification of the size of filesystem received by it, any modification, deletion or creation of partition depends upon filesystems to be gingerly unmounted and backed up to avoid risking a loss of data.
Read more: Why Ubuntu is better than Windows
Some Linux Utilities/Commands that come in handy for filesystem related operations include:
- disk – for creating, modifying, deleting a partition, including creating and printing partition table and so on.
- parted – performs same operations as fdisk and even many more also considered.
- df – displays all the filesystems mounted on Linux Filesystem and their mount points.
- mount – for mounting filesystems, directories, changing mount point for a directory/device and all sorts of such operations.
- makes – creating and formatting a filesystem. Usually, a command is used in concatenation with the type of formatting desired. Like: makes.ext4 for a formatting file system with type ext4.
- umount – for unmounting filesystem from a partition.
- GParted/QParted – GUI Parted for Gnome and KDE systems.
- Disks – Software Utility pre-installed on Linux systems for managing partitions through GUI.
Linux Utilities/Commands for Changing or Modifying Partition Names/Labels
Commands for changing or reformed Partition Name/ Label are humbled on a type of filesystem on that partition with an omission of some general commands.
Below you can find a listing of all such commands.
e2label or tune2fs
The commands e2label or tune2fs used for changing the label of ext2, ext3 and ext4 type partitions.
# e2label dev/sda1 ROOT OR # tune2fs –L ROOT_PART /dev/sda1
ROOT_PART are the labels to be added to
/dev/sda1 which is an ext4 formatted partition.
The exfat label command used for changing the label of exFAT formatted partition.
# exfatlabel /dev/sda3 EX_PART
The ntfslabel command used for changing the label of NTFS partitions.
# ntfslabel /dev/sda5 NTFS_DIR
The reiserfstune command used for stamping ReiserFS formatted partitions
Note: It is judicious to first unmount the filesystem before this command.
# reiserfstune –l HOME_PART /dev/sdb1
/dev/sdb1 is the partition formatted with ReiserFS filesystem.
Changing Label of a partition in GUI – DISKS
Disks is a pre-installed utility found in most Linux systems which are today GUI for doing all the partitions associated tasks which are done by fdisk and parted and even more than that. Disks can be used to switch the label of a partition by the following procedure:
GUI of Disks showing, all the external drives and technicality of selected external drive in addition to partitions, their labels, their size, and type of formatting. The first step is to select the dividing whose label is to be changed, which is Partition 1 here, the next step is to select gear icon and edit filesystem.
After this, you will be prompted to change the tag of the selected partition.
And finally, the label of the partition will be switched.
The MK swap command used for growing label of a SWAP partition.
After unmounting the filesystem, following command needs to be executed to change the label of a swap partition.
# mkswap -L SWAP_PART /dev/sda5
/dev/sda5 is the SWAP matted partition.
Special Linux Utilities to Mount Partition with Label Names
1. Using Label for loading partition at boot time – /etc/fstab file
/etc/fstab is the file which is parlayed at the boot time to mount the partitions that exist on the system. Partitions are by default identified by using UUID as per the entry in this /etc/fstab file.
But, there is another way to load the partition, instead of that long UUID, you can just pass the label of that partition in the file instead of UUID and from then on, your system would escalate the partitions on the system using LABEL instead of UUID.
For stowing any partition using Label averagely than UUID just open the /etc/fstab file for editing:
$ sudo vi /etc/fstab
The file looks like below:
Here, a partition is remembered using UUID as seen above. Now if you wish the partition to be evoked using label just edit the corresponding entry in the file replacing
LABEL=. Again, save and close the file. On next boot, the partition will be loaded using a label, on the contrary, UUID
2. Changing entries of partitions in partition table:
Some commands can be used to perform with foyer of partitions in the partition table and shuffle the entries in the partition table
These commands include:
Mount can also be used to change the name of the partition. The following practice can be used here:
# umount /partition
Unmount the partition.
# mountpoint /partition &>/dev/null || mv /partition /new_name_partition
Change the name of the directory after it is unmounted.
# mount /new_name_partition
Edit /etc/fstab and change the mount point of partition from /partition to /new_name_partition and then remount the partition.
A utility which can be used to observe many useful operations on partitions, but displayed here is one of its operations to change the partition names.
Procedure to follow:
This opens the gdisk and you will be prompted to enter the disk to be preferred. Just enter the disk you want to select.
'/dev/sda' for operating on prime hard disk.
Next, you will get consecutive prompt would appear asking you to enter any command. Enter ‘c’ here. You will be prompted to select the partition number whose name you want to trim. Enter the partition name and then you will be persuaded to enter the new name. Enter the new name and hit ENTER.
Command(? For help):
Next, use the following option to verify that the change you did is done.
Command(? For help): p
Now Close and exit gdisk, saving your changes.
Command(? For help): w
Above is the performance presented for Changing/Modifying the Name/Label of Linux Partitions. If you retain other striking techniques which may acquire the same thing to share with us.