How To Resize Active/Primary root Partition In Linux Using GParted Utility

Today we are going to discuss about disk partition. It’s one of the best topics in Linux. This allow users to resize the active root partition in Linux.

In this article we will teach you how to resize the active root partition on Linux using Gparted utility.

Just imagine, our system has 30GB disk and we didn’t configure properly while installation the Ubuntu operating system.

We need to install another OS in that so we want to make secondary partition on that.

Its not advisable to resize active partition. However, we are going to perform this as there is no way to free up the system.

Note : Make sure you should take backup of important data before performing this action because if something goes wrong (For example, if power got failure or your system got rebooted), you can retain your data.

What Is Gparted

GParted is a free partition manager that enables you to resize, copy, and move partitions without data loss. We can use all of the features of the GParted application is by using the GParted Live bootable image. GParted Live enables you to use GParted on GNU/Linux as well as other operating systems, such as Windows or Mac OS X.

1) Check Disk Space Usage Using df Command

I just want to show you about my partition using df command. The df command output clearly showing that i only have one partition.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        30G  3.4G 26.2G  16% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            487M  4.0K  487M   1% /dev
tmpfs           100M  844K   99M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            498M  152K  497M   1% /run/shm
none            100M   52K  100M   1% /run/user

2) Check Disk Partition Using fdisk Command

I’m going to verify this using fdisk command.

$ sudo fdisk -l
[sudo] password for daygeek:

Disk /dev/sda: 33.1 GB, 33129218048 bytes
255 heads, 63 sectors/track, 4027 cylinders, total 64705504 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000473a3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    62609407    31303680   83  Linux
/dev/sda2        62611454    64704511     1046529    5  Extended
/dev/sda5        62611456    64704511     1046528   82  Linux swap / Solaris

3) Download GParted live ISO Image

Use the below command to download GParted live ISO to perform this action.

$ wget https://downloads.sourceforge.net/gparted/gparted-live-0.31.0-1-amd64.iso

4) Boot Your System With GParted Live Installation Media

Boot your system with GParted live installation media (like Burned CD/DVD or USB or ISO image). You will get the output similar to below screen. Here choose GParted Live (Default settings) and hit Enter.

5) Keyboard Selection

By default it chooses the second option, just hit Enter.

6) Language Selection

By default it chooses 33 for US English, just hit Enter.

7) Mode Selection (GUI or Command-Line)

By default it chooses 0 for GUI mode, just hit Enter.

8) Loaded GParted Live Screen

Now, GParted live screen is loaded. It is showing the list of partition which was created by me earlier.

9) How To Resize The root Partition

Choose the root partition you want to resize, only one partition is available here so i’m going to edit that partition to install another OS.

To do so, press Resize/Move button to resize the partition.

Here, enter the size which you want take out from this partition in first box. I’m going to claim 10GB so, i added 10240MB and leave rest of boxes as default, then hit Resize/Move button

It will ask you once again to confirm to resize the partition because you are editing the live system partition, then hit Ok.

It has been successfully shrink the partition from 30GB to 20GB. Also shows Unallocated disk space of 10GB.

Finally click Apply button to perform remaining below operations.

  • e2fsck e2fsck is a file system check utility that automatically repair the file system for bad sectors, I/O errors related to HDD.
  • resize2fs The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located on device.
  • e2image The e2image program will save critical ext2, ext3, or ext4 filesystem metadata located on device to a file specified by image-file.

e2fsck e2fsck is a file system check utility that automatically repair the file system for bad sectors, I/O errors related to HDD.

resize2fs The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located on device.

e2image The e2image program will save critical ext2, ext3, or ext4 filesystem metadata located on device to a file specified by image-file.

All the operation got completed and close the dialog box.

Now, i could able to see 10GB of Unallocated disk partition.

Reboot the system to check this.

10) Check Free Space

Login to the system back and use fdisk command to see the available space in the partition. Yes i could see 10GB of Unallocated disk space on this partition.

Suggested Read : How To Manage Disk Partitions Using Parted Command

$ sudo parted /dev/sda print free
[sudo] password for daygeek: 
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
        32.3kB  10.7GB  10.7GB           Free Space
 1      10.7GB  32.2GB  21.5GB  primary  ext4         boot

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...

Shares
Close
Please support the site
By clicking any of these buttons you help our site to get better