I have a 64-bit Ubuntu 12.04 KVM instance which I built from an image I purchsed from stacklet.com and converted to KVM format with Cloudmin.
When I created the VM, I set the root disk to 40GB and swap to 1GB. It created two disk images: 20GB root and 1GB swap. However, the swap image was not mounted. I was able to mount the swap by adding it (/dev/sdb1, as reported by fdisk) to /etc/fstab. I also chaned LABEL=root to /dev/sda1 for the root device.
I then tried to resize the 20GB image to 40GB, which failed. I noticed the device name was listed as /dev/hda for the root disk and /dev/hdb for swap. I tried to change these to /dev/sda1 and /dev/sdb1 with no success -- it says it worked, but remained set to the initial values.
There's other strangness going on too, e.g. I tried to remove the swap disk and re-add it, and it added as the root disk (i.e. "Mounted on / as Linux EXT4 (new)").
I wonder if this will be fixed by http://www.virtualmin.com/node/24175 or if there's another issue here.
Comments
Submitted by JamieCameron on Tue, 12/04/2012 - 15:33 Comment #1
What error did you get when the resize failed?
Submitted by fuscata on Tue, 12/04/2012 - 16:47 Comment #2
Right now I'm getting:
Warning - this disk cannot be safely resized. Cloudmin does not know what type of filesystem this disk contains, and so cannot properly resize it. This is most likely because the disk is not mounted on the virtual system.
However, there were different errors on different attempts as I tried various solutions. Sorry, didn't document them.
The real problem, I think, is that Cloudmin thinks this is /dev/hda while on the VM it's /dev/sda.
Submitted by JamieCameron on Tue, 12/04/2012 - 18:22 Comment #3
Could you post the
/etc/fstab
file from the virtual system?Submitted by fuscata on Tue, 12/04/2012 - 20:23 Comment #4
Ok so I broke the VM (could not ping or log in via SSH) by trying to resize the disk, but I had tried so many things, who knows what the state was at that point.
So I deleted it, and created a fresh machine. I chose 40 GB disk and 1 GB swap, but it created a 20 GB disk and no swap.
I logged in and did the following:
Then I shutdown, resized the disk and it worked! It still lists /dev/hda, but no matter.
The thing I know I did differently was correct the swap line in /etc/fstab (in addition to the / line).
Submitted by JamieCameron on Tue, 12/04/2012 - 23:28 Comment #5
The disk being shown as
hda
in Cloudmin butsda
on the VM shouldn't be a problem, as Cloudmin just assumes they are equivalent - the reasonhda
is used is that it is how the disk appears for most VMs. However, this depends on the kernel version running within the VM.So it sounds like the problem is fixed now? Most likely the cause was the
LABEL=
entry in/etc/fstab
instead of a device path.Submitted by fuscata on Wed, 12/05/2012 - 08:37 Comment #6
Yes, fixed, thanks. I left it open in case the incorrect swap line was an issue ('swap' -> 'none', 'defaults' -> 'sw'). Would be nice not to have to edit /etc/fstab when creating a VM.
Submitted by JamieCameron on Wed, 12/05/2012 - 10:39 Comment #7
The images we provide have the /etc/fstab file correct by default. However stacklet images do not, and unfortunately cloudmin needs to know which disks correspond to which filesystems to perform a safe resize..
Submitted by fuscata on Wed, 12/05/2012 - 10:58 Comment #8
Ah perhaps I can simply correct it, take a snapshot and build from that... Will give that a go, thanks for the help.
Submitted by JamieCameron on Wed, 12/05/2012 - 12:44 Comment #9
Yes, that's the best option.
Submitted by fuscata on Fri, 01/11/2013 - 14:17 Comment #10
Creating an image with a correct /etc/fstab works for the root disk, but not for swap. That line still must be edited by hand after building a new machine from this image.
Submitted by JamieCameron on Fri, 01/11/2013 - 18:51 Comment #11
Which specific line did you need to edit?
Submitted by fuscata on Fri, 01/11/2013 - 19:01 Comment #12
/dev/hdb1 swap swap defaults 0 0
I had to change /dev/hdb1 to /dev/sdb1
Submitted by JamieCameron on Sat, 01/12/2013 - 00:16 Comment #13
Once you change that and create an image from the VM, is Cloudmin changing it back tp /dev/hdb1 when you create a new VM?
Submitted by fuscata on Sat, 01/12/2013 - 01:10 Comment #14
Yes.
Submitted by fuscata on Sat, 01/12/2013 - 01:11 Comment #15
Submitted by JamieCameron on Sat, 01/12/2013 - 12:05 Comment #16
When you create this VM, do you have VirtIO mode enabled for disk? There is an option for it on the creation form..
If yes, I would recommend choosing "No" instead.
Submitted by fuscata on Sat, 01/12/2013 - 17:44 Comment #17
No dice. I tried with it set to "No" -- same results. (Before I've always kept it at "Based on image",)
Submitted by JamieCameron on Sun, 01/13/2013 - 23:48 Comment #18
Is there any chance I could get a copy of the VM image you are trying to create systems from?