resized drive and now swap drive not working - help

Discussions about using Linux guests in VirtualBox.
Post Reply
WayneG
Posts: 7
Joined: 15. Aug 2013, 17:19

resized drive and now swap drive not working - help

Post by WayneG »

I used Gparted to resize a virtual drive. The swap drive is there but is not being used by ubuntu.

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 186660863 93329408 83 Linux
/dev/sda2 186660864 194117631 3728384 5 Extended
/dev/sda5 186662912 194117631 3727360 82 Linux swap / Solaris
root@ubuntu-coldfusion:~# swapon -s
Filename Type Size Used Priority
root@ubuntu-coldfusion:~#


When I pull the drive up in Gparted the Swap is OFF. I can successfully turn it On and exit Gparted... but when I boot up the machine there is no swap. Then, when I go back in to Gparted (after having booted the machine) the swap is off (again).

Thanks for any help. Wayne
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: resized drive and now swap drive not working - help

Post by mpack »

Why ask about that here? If you used gparted then all you did was move data around on the disk, not something which VirtualBox cares about or supports.

ps. GParted resizes partitions, it is incapable of resizing drives. GParted is designed for use on physical PCs, where the notion of changing the size of the disk drive would be nonsensical. A failure to correctly distinguish between drives and partitions could be at the root of your problem.

Also, when you say "swap drive", is that what you really mean, or do you mean swap partition? If the latter then I'm interested to know why you think Ubuntu isn't using it. If the Ubuntu installer creates a swap partition then presumably it's intended to be used. If you were to shrink that swap partition then that could have unfortunate effects, especially if you did it e.g. while the VM was suspended instead of shut down.

FYI: A drive is a physical object with a fixed capacity. A virtual drive behaves as if it has a fixed capacity even when it only allocates that capacity on demand. A partitition is a software object, i.e. it forms the first level of the division of disk space into usable regions. E.g. this area for bootstrap code, this area for Ubuntu, this area to be used as a memory swap region.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: resized drive and now swap drive not working - help

Post by Perryg »

I would be more interested in seeing the results of the following from the guests terminal

Code: Select all

free -m
Also if you deleted the swap partition to be able to extend the primary partition & created it again then the swap UUID will be different and you would need to see if
blkid = the same UUID in the /etc/fstab and if they differ you would need to edit accordingly.

Still as Dan says this is not a VirtualBox issue but an issue with the guest OS.
WayneG
Posts: 7
Joined: 15. Aug 2013, 17:19

Re: resized drive and now swap drive not working - help

Post by WayneG »

Hi Perryg,

Thanks for the reply... I'll check the UUid in the fstab but I did not delete the swap partition.

root@ubuntu-coldfusion:~# free -m
total used free shared buffers cached
Mem: 2449 824 1625 0 296 154
-/+ buffers/cache: 373 2076
Swap: 0 0 0
WayneG
Posts: 7
Joined: 15. Aug 2013, 17:19

Re: resized drive and now swap drive not working - help

Post by WayneG »

Hi Perryg,

you were correct regarding the UUID not matching the fstab file... I changed it and it works fine

Thanks again for pointing me in the right direction.
Post Reply