hard drive - Resize Primary Partition in Ubuntu

08
2014-07
  • Kohjah Breese

    I've set up a Ubuntu server the wrong way round. On a 2TB hard drive I gave 20GB to the root system partition and 1.8TB to home. I'd like to reverse this. I'm reading there is a tool, which may be able to do this:

    resize2fs /dev/sda 1000000M
    

    But I'm getting conflicting information as to whether this can be done while the system is running. Can anyone uncloud this?

  • Answers
  • Rod Smith

    The resize2fs utility will resize the filesystem, but not the partition in which it's stored. It also won't shrink a mounted filesystem, as the first paragraph in its man page clearly states.

    A better solution for you is to boot an Ubuntu desktop installer into its live CD mode and use GParted to resize your partitions.


  • Related Question

    windows - Resize primary partition
  • telebog

    I have a hard drive with the folowing partition table

    12Gb Primary Partition (ntfs) 140Gb Extended Partition (ntfs)

    I want to install Windows 7 and I need more space for the Primary Partition.

    The problem is that when I resize partitons I obtain:

    12Gb Primary Partition (ntfs) 110Gb Extended Partition (ntfs) 30Gb Free Space

    So I can't allocate the free space to primary partition because the free space is at the end of the disk.

    Is there a solution to extend the primary partition as: 42Gb Primary Partition (ntfs) 110Gb Extended Partition (ntfs) without repartitioning the entire disk?

    I used partition magic, gparted-live-0.4.6-4 and others with no success. With the Disk Management from Vista I manage to extend primary partition, but made my partitions dinamic.


  • Related Answers
  • Avinash Raj

    You can be able to resize your ntfs primary partition through Ubuntu live disk or gparted live disk.

    1. Boot from gparted live disk or Ubuntu live disk.If you boot from Ubuntu live disk, then click on Try Ubuntu option on startup.By default, gparted utility would be installed on Ubuntu live disk.Open gparted partition Editor from dash(An alternative to Windows Start Button on Ubuntu).

    2. Let us assume, your partitions would be look like this.

      enter image description here

      Linux disk naming system was completely different from Windows disk naming system.In the above screenshot /dev/sda refers to your first disk.And /dev/sda1,/dev/sda2,.., refers to the partitions present in your first disk.

    3. Assume /dev/sda2 is your ntfs primary partition(Where you're going to install Windows ).IMO you are willing to add 2.73 unallocated space to your /dev/sda2 ntfs partition.I'm going to explain how to add that unallocated space to your /dev/sda2 primary partition with the above screenshot as an example.

    4. To resize your ntfs primary partition, you have to get out of the unallocated space from the extended partition and move that unallocated space just below to your ntfs primary partition.The unallocated space is not present below the extended partition, it's inside the extended partition(take a look at the screenshot clearly).

    5. Right-click on the /dev/sda5 and select Resize/Move option.Now, move the /dev/sda5 partition by click and move the dragger to the extreme right, so that the unallocated space will comes above to the /dev/sda5 partition.

      enter image description here

      Now your partitions will looks like this,

      enter image description here

    6. Now, right-click on that /dev/sda3 extended partition and select Resize/Move option.Shrink it's space, so that the unallocated space present inside the extended partition will comes out of that(just above to the /dev/sda3 extended partition).

      enter image description here

    7. Oh, it comes out of the extended partition.Now you can be able to increase the size of your ntfs primary partition(/dev/sda2)

    Note: Make sure that all the partitions are unmounted, before doing the above operations.It takes some time according to the size of your extended partition while moving between the partitions, so be patient.Finally don't forget to take backup of all your important datas.

  • harrymc

    You need to move the extended partition to the end of the disk so that the the empty space is just after the primary partition.

    When you demand the partition manager to extend the primary, it can't automatically move the extended partition. You need to do this manually using your favorite partition manager. This is a very slow operation, so wait patiently.

    In addition to the other partition managers that you've tried, you might also look at Paragon Drive Backup 9.0 Free Edition. I haven't actually had the occasion to use it, but its interface looks nice.

  • Bobby

    Disclaimer: Like with all partition-altering methods, you should have a backup. I've worked with gparted for over 5 years now and never had a problem. But the possibility to lose everything is omnipresent when altering partitions.

    With the gparted Live-CD you should be able to move the second NTFS partition to the end of the harddisk. Let me draw you some art:

    : --> First Partition
    | --> Second Partition
    = --> Free Space
    
    ::::::||||||||||||||||||======== --> Now move the last partition to the end
    ::::::========|||||||||||||||||| --> Now you can allocate the additional space/resize
    ::::::::::::::||||||||||||||||||
    
  • verstapp

    But as the original extended partition is quite likely 'the rest of the space on the disk', you will quite likely have to shrinnk that partition before expanding the primary one.