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.
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
6) Language Selection
7) Mode Selection (GUI or Command-Line)
8) Loaded GParted Live Screen
9) How To Resize The root Partition
e2fscke2fsck is a file system check utility that automatically repair the file system for bad sectors, I/O errors related to HDD.
resize2fsThe 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.
e2imageThe e2image program will save critical ext2, ext3, or ext4 filesystem metadata located on device to a file specified by image-file.
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.
$ 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