# How to get back lost capacity after using Gparted?

I have a laptop with a single Intel 80GB SSD. I originaly only had W7, but installed Ubuntu on a small partition of this disk. Recently I wanted to expand the partition containing Ubuntu and so booted up from a USB to run Gparted from there. The idea was to resize the W7 partition and use this extra space for my Ubuntu partition. I had:

Windows partition 61GB
Ubuntu partition 9,3GB
Linux-Swap 4GB


Resizing the W7 partition using Gparted went fine, which gave me some unallocated disk space. I now needed to move this unallocated space next to my ubuntu partition. To do this I deleted the swap disk used by Ubuntu in order to expand the Ubuntu partition in to this area of the hard drive. Which means I had:

Windows partition 56,17GB
Unallocated 4,88GB
Ubuntu partition 9,3GB
Unallocated 4GB


I then used then used the unallocated space from the Windows partition as a new swap disk:

Windows partition 56,17GB
Linux-Swap 4,88GB
Ubuntu partition 9,3GB
Unallocated 4GB


And at last I wanted to extend my ubuntu partition to include the now unallocated space from the old swap. This is where I had trouble.

I tried do resize the Ubuntu partition in Gparted, but got an error message that I did not save. The Ubuntu partition did grow however and according to Gparted I now have:

Windows partition 56,17GB
Linux-Swap 4,88GB
Ubuntu partition 13,5GB


The problem is that the additional 4GB in the Ubuntu partition don't show up, it is as if I gained 4GB, but that these 4GB are being used by some file. When running df -h the partition is still being listed as 9,3GB and not 13,5GB as in Gparted.

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5       9,3G  7,5G  1,3G  86% /
none            4,0K     0  4,0K   0% /sys/fs/cgroup
udev            2,0G   12K  2,0G   1% /dev
tmpfs           393M  864K  392M   1% /run
none            5,0M     0  5,0M   0% /run/lock
none            2,0G  488K  2,0G   1% /run/shm
none            100M   36K  100M   1% /run/user
/dev/sda1        57G   44G   13G  79% /media/OS


I wanted to post an image of Disk Utility, but as this is my first question I'm not allowed. It does show the partition as being 14GB however.

I have tried using fstrim -v /, but this didn't seem to help.

GParted 0.12.1 --enable-libparted-dmraid

Libparted 2.3

Check and repair file system (ext4) on /dev/sda5  00:00:04    ( ERROR )

calibrate /dev/sda5  00:00:00    ( SUCCESS )

path: /dev/sda5
start: 128,047,104
end: 156,301,311
size: 28,254,208 (13.47 GiB)

check file system on /dev/sda5 for errors and (if possible) fix them  00:00:04    ( SUCCESS )

e2fsck -f -y -v /dev/sda5

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

234643 inodes used (37.27%, out of 629552)
332 non-contiguous files (0.1%)
596 non-contiguous directories (0.3%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 185927/200
1840791 blocks used (73.84%, out of 2492928)
0 large files

144531 regular files
20184 directories
57 character device files
25 block device files
0 fifos
69834 symbolic links (48423 fast symbolic links)
3 sockets
------------
234664 files

e2fsck 1.42.5 (29-Jul-2012)

grow file system to fill the partition  00:00:00    ( ERROR )

resize2fs /dev/sda5

resize2fs 1.42.5 (29-Jul-2012)
resize2fs: /dev/sda5: The combination of flex_bg and
!resize_inode features is not supported by resize2fs.

-
That is an unusual combination of features. How did you format this filesystem? Any ext[23] filesystem made in the last few years should have resize_inode enabled, and any filesystem with flex_bg should be an ext4 filesystem which should also automatically have resize_inode enabled. –  psusi Oct 9 '13 at 4:25

The problem appears to be with resizing the Ubuntu file system (likely ext2, ext3, or ext4) with resize2fs 1.42.5.

You might try booting from media containing the latest GParted Live (most recent stable version is 0.16.2-1b). This live image uses a newer version of resize2fs 1.42.8-1.

This newer version of GParted (0.16.2) will also indicate if there is unallocated space within the partition.

-
This worked! :) I was not aware there was a newer version, it immediately recognized the disk as being the right size and after a CHECK it showed the correct amount of used space as well, thank you! –  user199869 Oct 9 '13 at 12:13

Open gparted again and run a CHECK on the filesystem. This will also expand it to use all of the available space.

-
I opened Gparted from the USB again and tried to run a CHECK on the Ubuntu partition, however I got an error message. I'll post the details in the question. –  user199869 Oct 8 '13 at 18:39

Your explanation is a rather hard to follow but when you are dealing with Windows it would have been better to resize the drive with Windows to avoid a lot of troubles. In windows you type this in Run > diskmgmt.msc and disk management will pop up. You would want to do all the resizing of windows there. I definitely think you should run diskmgmt to see what it shows. Windows is able to move its own files when you resize a partition with diskmgmt but Linux will not. also you may well want to run Bleachbit on your Ubuntu install to clean out the junk files. You may be surprised on how much space you will regain if you haven't used it before. You can download Bleachbit from Ubuntu Software Manager. Run Bleachbit both as root and user to remove the move junk.

-
Thanks for the answer! Running Bleachbit did not seem to work and according to Windows everything seems fine. I have the 56,17GB NTFS windows disk along with two other disks with 4,88GB (the swap disk) and 13,47GB (where Ubuntu is stored). I will try to make it clearer in the question! :) –  user199869 Oct 8 '13 at 15:20
Since the problem is with expanding his Ubuntu partition, not resizing the Windows partition, or freeing up space on the Ubuntu partition, this fails to answer the question. –  psusi Oct 8 '13 at 17:30
Are the partitions aligned to page boundaries? linux-mag.com/id/8397 explains how and why. –  K7AAY Oct 8 '13 at 21:03