PDA

View Full Version : Linux - Shrinking a Partiition to Create Free Space



n2ize
04-29-2016, 02:32 PM
Hi, I am currently running Fedora 22. Since I first partitioned my disc and installed Linux on this system my /var folder (which is on the root partition) has been growing in size, to the point where it's next to impossible to do upgrades because the cache under /var is too small. I want to move /var to it's own separate partition. I currenntly have a partition containing the filesystem "/mnt/volume1" that I use for projects, storing files, videos, etc. It is quite a large partition and only about 10% full. I would like to shrink this partition by about 25% - 30% and use the free space to create a new partition which will contain /var .

From what I have read I believe I can use the "parted" or "gparted" utility to change the partition size. The question I have is once I shrink the partition will the reclaimed space show up as free space such that I can use parted (or fdisk) to make the new partition for /var ? If I can accomplish this successfully then I can copy the contents of /var to the new partition and format it (ext4) and then change fstab so that it will mount as /var boot time.

Any suggestions ? Would the parted utility and fdisk be the best utilities for this of is their a better solution these days ?

ad4mg
04-29-2016, 03:47 PM
Gparted should do the job for you John. Below is Gparted showing an NTFS partition on one of my HDD's. Note the orange arrow in the lower row of icons.
14609

Clicking that brings up the resizing window:
14610

You can resize the beginning or end of the partition by either dragging the arrow on either end of the partition, or you can enter the sizes manually.

14611

14612

The empty space created becomes "free space", which can become a new partition, or provide space for expanding an existing partition.

Gparted is about as user-friendly as it gets, as long as you understand the various partitioning schemes!

n2ize
04-30-2016, 03:08 AM
Okay. This is exactly what I need. It will do exactly what I want. I used Gparted a long time ago when I had to re-partition a drive on a Windows machine to make room for Linux and I remember it worked fine. I'll give it go. Thanks for the help.

N2CHX
04-30-2016, 10:34 AM
Yep. Gparted is the standard, proven tool for this.

n2ize
04-30-2016, 02:48 PM
I might be able to simply shrink the /mnt/volume1 partition and then allocate the free space to the root partition which will mean there will automatically be more space for the /var directory which lies on the root partition. That will save me the trouble of having to create a new partition and move /var over to it and then change fstab.

n6hcm
05-01-2016, 05:17 AM
yup ... that should do the trick.