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 have a Virtual Box Ubuntu guest and i need to have more space on my disk (actually it's 8 gb). I have already increased the space allocated for the VDI to 16 gb.

Now with GParted Live i'm trying to expand my partition, but the swap blocks the expansion, as is in this image

the situation now

I'm going to do some move/resize to get the unallocated space near the /dev/sda1.

The operations are these:

future

Now, if i do this, surely i will have problems with the next boot. What i have to do to fix that?

share|improve this question
    
You may not even need a swap when running Ubuntu in virtual box. –  Takkat Oct 23 '11 at 16:49
    
what are the disadvantages of having swap on a file like albercuba said? –  apelliciari Oct 23 '11 at 17:29
1  
None, swap on file is fine but you don't really need a swap that would enable you to suspend your RAM to disk - however you don't do that in virtual box. Try without (you can always assign a swap on file later if you feel like you need it). –  Takkat Oct 23 '11 at 17:53

2 Answers 2

up vote 3 down vote accepted

The resizing operations won't cause any issues with the filesystem, but you may need to update your /etc/fstab to point at the new partition ID.

  1. use GParted as you've described.

  2. Find the updated UUID of the swap partition from the output of:

    sudo blkid

  3. edit /etc/fstab in the guest OS to have the new UUID in the line with a 'type' of 'swap'

That should do it.

share|improve this answer
    
this worked, even without the edit to /etc/fstab; there was no line of type 'swap' in there and system booted successfully after the gparted operations –  apelliciari Oct 23 '11 at 19:00

Just delete the swap partition and use a swap file. To do this type: This example is for a 1GB swap file

dd if=/dev/zero of=/swapfile bs=1024 count=1048576
mkswap /swapfile
swapon /swapfile

Be sure to tell the OS to stop using the swap partition before you delete it, like this.

swapoff /dev/nameOfCurrentSwap

And remove or comment out the line in fstab that points to it.

Then you have to enable the swap space at boot time, add this line in fstab:

/swapfile none swap sw 0 0
share|improve this answer

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.