1

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!

4
  • Is the space that was occupied by sda1 and sda2 bigger than sda7?
    – Paul
    Jun 23, 2014 at 0:18
  • Yes, it is roughly 180GB. I have also tried gparted but since it's the / mount I'm under the assumption (which could be wrong) that I need to do it via booting into a non-graphical environment with it unmounted.
    – user973479
    Jun 23, 2014 at 0:37
  • 1
    Are you sure you need more than 180GB in your root partition? Normally far less than that would be required. If you have /home in the root partition, this would be a good time to move it.
    – Paul
    Jun 23, 2014 at 3:34
  • I guess I'm coming from a Windows background where everything is mashed together in one location "C:". I'm starting to guess that I should break things into a 20GB root, a 12gb swap (since 6GB memory) a 0.5 boot and allocate the rest to a home? If so I may as well reformat vs using gparted (though it's nice to know it exists)
    – user973479
    Jun 25, 2014 at 1:07

1 Answer 1

3

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 run gparted 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.

1
  • If you don't have/want a CD and your machine supports boot from USB, Unetbootin can write an Ubuntu Live CD ISO to a thumb drive and you can boot from there. Back up, boot, use gparted to move/resize partitions, and voila. Do it before you go to bed, it'll be done by morning, 180GB will take a few hours. If possible try to perform gparted options in such an order that the complete move/resize of the large partition is a single step.
    – Jason C
    Jun 23, 2014 at 1:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .