Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to resize my root partition using Gparted but before doing it I want to make sure I'm doing it correctly. Here is a screenshot of my GParted:

GParted screen

So, my question is:

Assuming I launch Ubuntu from a LiveCD and I get to run GParted how should I give space from the home folder to the root folder knowing that the SWAP is in the middle? What is the correct process to minimize the risk of screwing up?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

I recently did this. Be careful to boot your computer from a live cd of the SAME version of ubuntu as you have installed, if you can. (I'm superstitious!)

Then start Gparted. From here on it is a slow sliding block puzzle.

Click on your /home partition, then right click it and select 'Resize/Move. When the graphic pops up, use your mouse pointer to take hold of the left hand handle of the /home partition and slide it right to shrink the partition as much as you need. Click on the Resize/move button, then the green check mark on the toolbar and the shrinking will start -and it will take a fair time to complete.

Now click the swap partition, then right click it and select 'Resize/Move. When the graphic pops up, use your mouse pointer to grab the middle of its graphic and slide it right until it butts up against the /home partition. Then click the Resize/Move button, then the green check mark on the toolbar to move it. When this is done, there will be space on its left to fill up with the /root partition.

Click on your /root partition, then right click it and select 'Resize/Move. When the graphic pops up, use your mouse pointer to take hold of the right hand handle of the / partition and slide it right to bring it up against the swap partition. Click on the Resize/move button, then the green check mark on the toolbar and the expanding will start -and, again, it will take a time to complete.

I know, I know, I could have done the whole sliding block thing in one go and then clicked on the green check mark just once, but to me the process feels less risky doing each move independently. You WILL back off any irreplaceable files before you start, won't you? A power cut could prove disastrous... Wordy though my solution is, this is the simplest, entirely graphical way, if you can believe that!

For added security, you could install Boot Repair on your hard disk (https://help.ubuntu.com/community/Boot-Repair) . Then if you find it has all gone wrong, you could use a SuperGrub2 CD to boot your system and then run boot repair to fix grub.

Good luck,

Vic

share|improve this answer
    
So, with your solution I won't have to edit the fstab file right? –  Nobita Feb 20 '12 at 19:28
    
That's right, no fstab editing. –  Vic Feb 27 '12 at 14:48

The simple way is to delete the swap partition, shrink /dev/sda7, expand /dev/sda5, then recreate /dev/sda6 as swap. Once you've done that, you can find the swap partition's UUID by running this

ls -la /dev/disk/by-uuid | grep sda6 #(assuming it was created as /dev/sda6)
lrwxrwxrwx 1 root root  10 2012-02-12 10:35 8bfea793-5cb2-480c-a4e3-2b3c331463bb -> ../../sda6
#                                           |---- This is the UUID ------------|

and then copy and paste that into fstab in place of the old UUID.

cat /etc/fstab | grep swap
UUID=8bfea793-5cb2-480c-a4e3-2b3c331463bb none            swap    sw              0       0
#    |------ Replace this part   -------|                 ^Will be the only line that says 'swap'
share|improve this answer
    
You'll need to be root to edit /etc/fstab, run sudo gedit /etc/fstab or sudo nano /etc/fstab. You should back it up first with sudo cp /etc/fstab /etc/fstab.old –  Huckle Feb 19 '12 at 21:53
    
I should do all that while running from a Live CD right? –  Nobita Feb 19 '12 at 22:22
    
You need to use the live cd because the partitions can't be mounted while doing this. –  Marty Fried Feb 19 '12 at 22:33
    
@Huckle: I think a simpler way to get the uuids is using "sudo blkid", but it's best to make sure you get any changed values, rather than cached values, by specifying no cache, ie: sudo blkid -c /dev/null –  Marty Fried Feb 19 '12 at 22:38
    
When I shrinkg sda7 will that make space for swap? I'm afraid that when I delete sda6 (swap) and I expand sda5, I will be eating space of sda6 and therefore when trying to create it back, there will be no space between sda5 and sda7. –  Nobita Feb 19 '12 at 22:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.