GParted is an essential system administration tool. Learn to use it wisely.
Last week, you found Ten Essential Linux Admin Tools with which to familiarize yourself. But, don’t overwhelm yourself with self-discovery of all ten, because this week you’ll learn one of those tools, GParted. It is a powerful ally to those who handle it with wisdom and restraint and a harsh mistress to those who throw caution to the wind.
GParted is the Gnome Partition Editor. With it, you can create, reorganize and delete disk partitions. Generally speaking, it preserves the contents of those partitions but there is a potential for loss. Its most common usage is for those who want to resize disk partitions–a task that it performs very well.
Download a live CD image from the GParted site and burn it to disk. Boot your system from the CD or ISO image, select your language from the list of options, select your video mode (Start X automatically (recommended), Manually using Forcevideo or Command line).
For this demonstration the following selections were used: Forcevideo, Option 2(1024×768), vesa and Option 1(16 bit color). It’s recommended that you allow the system to start automatically in graphical mode before you attempt a manual configuration because it could otherwise take several reboots to configure everything correctly.
Once booted into the graphical interface, GParted starts automatically and presents you with all detected disks (Figure 1). Now that you’ve come this far, it’s time to get started with GParted.
Figure 1: GParted Showing Unallocated Disk Space
Right click the unallocated space, New. See Figure 2 for the warning that this is a new disk that has no partition table. The dialog box provides you with instructions for creating a partition table (Device->Create Partition Table). Click OK to dismiss the dialog box.
Figure 2: GParted Warning and Partition Type Choices
From the GParted menu, select Device. You receive a warning that this action will erase all data from the device (/dev/sda). The default partition table is MS-DOS but you can override this by clicking the Advanced Selector and choose the type you want from a list of ten. For Linux users, ignore the implications of the msdos partition table type and select it as your preferred option. Click Apply to accept your choice.
Right click the unallocated space again and a new window appears to guide you in allocating this space for use as shown in Figure 3.
Figure 3: Creating a New Partition
Select your specific configuration for the space, the partition type (Primary, Logical or Extended), the filesystem type and enter a label (optional). Click Add, Apply and Apply again to finish. See Figure 4 for the finished product. Note that the cost of creating the filesystem is roughly 5% of your available space.
Figure 4: The New Partition
You receive an email minutes after creating the new partition informing you that you need to create two partitions in that newly allocated space. One must be 100MB and the other will consume the remaining space. Using GParted’s magical resize partition functionality, you can fulfill that request as easily as you could before you created the original partition.
Highlight the new partition and select Resize/Move from the toolbar. You have two ways to accomplish this resize. You can use the slider bar in the Resize/Move dialog box or you can alter the sizes manually using the numeric entry fields (Both shown in Figure 5). Click the Resize/Move button to accept your choices.
Figure 5: Resizing the Partition
Notice, in Figure 6, that GParted shows that you only have 88.20MB available in your partition. You see that creating the original partition and then resizing it has used 12.80MB of your space. To regain some of this space, reformat the 100MB filesystem by right-clicking the partition, selecting Format to and choosing ext4 for your filesystem. Click Apply to complete the change.
Figure 6: The Resized Partition and Unallocated Space
You can see that GParted used far less (8.71MB) of your space for the new partition and filesystem creation. Create a filesystem in your 400MB partition. Figure 7 shows both finished and formatted partitions.
Figure 7: Resized and Allocated Partitions
Back up your data before performing any partition or filesystem alterations. That’s your warning. You noticed that when you resized the 500MB partition into two smaller partitions, the smaller partition was shrunk and the larger partition became unallocated space. Data in that part of the drive was destroyed. If you format a partition, the data will be destroyed. If you lose data by performing resizing or reformatting on your partitions, don’t blame the GParted developers; blame yourself.
Resizing partitions on-the-fly is a great way to manipulate space allocation. It’s also a wonderful way to lose data. It’s a technical trade-off. If your partitions are new, then feel free to change them at will. However, if you’re altering live filesystems that contain user data, chances are very good that you’re going to lose some of it.
GParted is one of those tools that requires thought, planning and careful execution. You want this incredible free tool to liberate you from the bondage of lengthy battles with traditional partitioning methods but not as a liberation from employment altogether. With great power comes great responsibility.
Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62