I had a dual boot hard drive with Windows / Centos 6.5.
I no longer needed Windows so I removed the /dev/sda1 and /dev/sda2 via fdisk. It now looks like:
Device Boot Start End Blocks Id System
/dev/sda3 * 21891 21955 512000 83 Linux
/dev/sda4 21955 31131 73707864 5 Extended
/dev/sda5 21955 21981 204800 83 Linux
/dev/sda6 21981 23511 12288000 82 Linux swap / Solaris
/dev/sda7 23511 31131 61211648 83 Linux
I would like to take the space that was used by Windows and add it to sda7
I have played around with parted,resize2fs,lvextend, etc but I can't seem to figure out exactly how to do this. Can anyone help by providing me with specific fully-working steps/commands?
Thanks!
Best Answer
Before performing this task, it's highly recommended that you backup your data.
You cannot resize the partition under the Operating System working/running from the same partition.
In your case, if the
/dev/sda7
is your/
file system from which you work and try to resize it, then you need to boot your machine from different place. You can make live CD, boot the machine from DVD or USB and rungparted
from there. You can boot from Ubuntu's LiveCD and use GParted on it or download GParted's LiveCD .iso, burn it to a CD and boot into it.Unmount (if it's mounted) the partition that will be involved in the resize/move operation, /dev/sdaX (by right clicking and selecting unmount from the context menu),
Since the unallocated space is to the left of the ext4 partition you wish to resize, you'll first need to move the partition to the left of the unallocated space, which might cause boot error. Follow GParted's instructions on moving partitions.
As Gparted moves partitions, not unallocated space, it is may be quite complicated task to get your aim. This is because you have a number of partitions. So you probably need to move them all to the left. At the final step your partition
/dev/sda7
will be moved and resized (increased).Moving partitions is a copying itself, so it is going to take many hours. So probably it would be easier to save all critical data as backup to external drive, and then delete all partitions, design a new partitioning, reinstall OS and restore your data from backup.