16

I'm a brand new user to Ubuntu and Linux for that matter. I just installed Ubuntu in a Dual-Boot setup and loaded all the updates I could get.

During installation it asked me to set the partition sizes between Ubuntu and Windows Vista. However, it did not differentiate which partition was which on the screen when I set them, so I gave Ubuntu about 75% of my disk space (about 125GB compared to only 80 for Vista). I was aiming to give Ubuntu 80GB of space, and the rest to the Windows partition. However, I got them backwards and Ubuntu now commands the majority of space.

Is there a way to reduce the partition size and give the majority back to the Windows partition? Can anyone point me in the right direction for giving the partitions the appropriate size also? 80GB was a guess, so that I had room to install apps.

Thanks.

BuZZ-dEE
  • 14,223
Seth Church
  • 163
  • 1
  • 1
  • 4
  • yes, it's possible but you might want to pause for some 'partition planning'. Also, can you edit your question to include the output of sudo fdisk -l to show us what partition layout you have. – DrSAR May 07 '13 at 05:34
  • Thanks for the response. I was unable to use the command given above. I think fdisk -b would have worked, but I was able to see my partitions in gparted so that's what I used. Thanks again! – Seth Church May 08 '13 at 06:11

2 Answers2

17

Yes, there is a way to resize your partitions. However, depending on the different partitions you have and their locations, it might be a long process to resize. Nonetheless, here's what you can do, and what I always do. This method uses a utility called GParted.

Before we begin, it is advisable that you take a backup of your data.

Step 1

Boot up from the USB/CD that you used to install Ubuntu, as if you were installing it from scratch. But instead of choosing to "Install Ubuntu", you'll choose "Try Ubuntu". This will boot into the Ubuntu on your USB/CD, not the one you installed. Connect to the internet, and install GParted. GParted is a utility that helps you partition disks. To install it, open up a terminal using Ctrl+Alt+T and then type:

sudo apt-get update && sudo apt-get install gparted && gksu gparted &

Step 2

GParted should come up. My GParted looks like this:

enter image description here

The top right states the hard drive we're currently viewing. In my case, it's /dev/sda. In your case, it most probably will say the same thing, or something else like sdb instead of sda. If you have any other external hard disks or USB sticks connected to your computer, they will also be listed in that drop down menu. It is very important that you make sure you choose your internal hard disk from that drop down menu. To be on the safe side, disconnect any other USB device and refresh GParted by hitting Ctrl+R.

Now, the list at the bottom shows the partitions in this hard disk. In my case, /dev/sda2 is my Window's partition, because it is of type ntfs, and it's fairly big in size (180 GB). My Ubuntu partition is the one that says type ext4, which is also the one that has a mount point of /. So, identify your Windows and Ubuntu partitions the way I did it.

Step 3

Now we do the resizing. It's as simple as right clicking on the partition and selecting "Resize/Move". Do that on your Ubuntu partition, and resize it. Don't worry, the resizing won't actually happen when you hit OK, it'll queue up all the operations so you can "apply" everything in the end. So what you're going to need to do is (1) resize your Ubuntu partition, (2) move the empty space so that it's after your Windows partition, and (3) resize your Windows partition and "expand" it to take over that empty space. Once you're done, take a look at the little diagram showing the partitions and make sure that everything looks okay; that there is no empty space lurking around. If you're satisfied...

As aforementioned, this process can take a LONG time. It's because of the resizing and moving of partitions around. It all depends on how big your partitions are, and how much space is being used. It once took me more than two hours to complete. But, it could only take you 20 minutes. If you want to, you can post a screenshot before applying so we can take a look at it. But again, if you're satisfied and willing to go forwards...

...hit the check mark in GParted to start applying all of these actions. Once done, reboot, and remove the USB/CD, and boot normally into your desired OS.

mchid
  • 43,546
  • 8
  • 97
  • 150
Alaa Ali
  • 31,535
  • thanks for the help. I was able to follow your instructions and get the drive sorted out (I believe). I have to check on the status when I get back to my computer, as I had to leave it while I am at work. I ran into two issues while trying to adjust my partitions. The first was that I was able to reduce the size of the ext4 partition, but was unable to expand the ntfs partition to allocate the free space to it. Somehow I figured out that the free space was included in the "extended" portion and the "linux-swap" partition was mounted or in use or something. – Seth Church May 08 '13 at 06:12
  • I was able to play with the "linux-swap" partition and unmount it, reduce the "extended" partition to exclude the free space, and then finally expand the ntfs partition to include the free space. Once I let the computer execute the task over night, the next morning I had an error message saying some of the tasks could not be executed. So I wound up with a very small amount of free space between the ntfs and ext4 and then a little after the ext4. I readjusted the partitions to allocate the free space to them, and the computer is now working those tasks. I'll report back when it is finished. – Seth Church May 08 '13 at 06:18
  • So, any news? Did reallocate the free space that was remaining? – Alaa Ali May 09 '13 at 04:59
  • Yes it did. I am good to go now. I'll take a sreenshot of Gparted tonight and load it here. Thanks for the help - I am really happy with it. Now to learn how to make DOSBox run my games :) – Seth Church May 09 '13 at 06:05
  • Gparted shows the left side of the partition filled. I was wondering whether there is difference between reducing partition's size from left and reducing from right. – Sudip Bhattarai Jan 04 '17 at 14:21
1

Warning: When dealing with partiotion, something might accidently go wrong. It is advisable that you have a complete backup of you system just in case. To have a back up done you can use something like Clonezilla.

To accomplish your task once you get a backup, You can boot from the Ubuntu Live CD, choose try Ubuntu. Once you get to the desktop you need to install Gparted. To do that, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below:

sudo apt-get install gparted 

Once installed you can run it, by typing sudo -i gparted at the prompt, and you should be able to re-size the partition.

Note: To re-size a partition, first make sure the partition is unmounted.

mchid
  • 43,546
  • 8
  • 97
  • 150
Mitch
  • 107,631