Submitted by Lucian on Wed, 03/16/2011 - 00:30
Hi,
I made a KVM Centos image but when I want to use it to install other VMs I get this error:
"expansion failed : Only the last partition on a disk image can be resized"
But I created the image specifically with swap the first partition and an ext3 one last (because I encountered this error previously).
Here's how my partition table looks like (i temporarily mounted the image on a loop dev so I can view partition table):
" Device Boot Start End Blocks Id System
/dev/loop1p1 1 250 2008093+ 82 Linux swap / Solaris
/dev/loop1p2 * 251 522 2184840 83 Linux
"
Any suggestions?
Status:
Closed (fixed)
Comments
Submitted by JamieCameron on Wed, 03/16/2011 - 01:07 Comment #1
What does the /etc/fstab file within the VM contain?
Submitted by Lucian on Wed, 03/16/2011 - 01:13 Comment #2
===
LABEL=/ / ext3 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/vda1 swap swap defaults 0 0
===
Hmm, that LABEL will be causing problems. I will replace it with /dev/vda2.
Should the swap space be defined first in the fstab file?
Submitted by JamieCameron on Wed, 03/16/2011 - 15:11 Comment #3
I'd advise replacing the LABEL= with /dev/vda2. Cloudmin cannot figure out which partition that maps to when a VM is down, which is why all our standard images avoid using it..
The order of the /etc/fstab file doesn't matter though.
Submitted by Lucian on Wed, 03/16/2011 - 20:03 Comment #4
Jamie,
Yeah, I figured that out as well and replaced the LABEL.. Cloudmin still won't enlarge the partition though.
Submitted by JamieCameron on Wed, 03/16/2011 - 20:11 Comment #5
So you are getting this error when creating a new VM from an image?
What if you try to expand the disk on the original VM - does the same problem happen?
Submitted by Lucian on Wed, 03/16/2011 - 20:16 Comment #6
Ok, I just tried your new Centos image with virtio support and I can expand it. I don't understand!
Here's how a vm created with my Centos image looks like:
[root@hj45 ~]# fdisk -l
Disk /dev/vda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/vda1 1 250 2008093+ 82 Linux swap / Solaris
/dev/vda2 * 251 522 2184840 83 Linux
It will not go beyond 4294 MB even though I told Cloudmin to create a 10 GB lvm. 4294 MB is the size of my template image.
This is how a vm created with your centos image looks like:
[root@mgd ~]# fdisk -l
Disk /dev/vda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/vda1 * 1 13 104391 83 Linux
/dev/vda2 14 1306 10381337+ 83 Linux
The size is normal, just like I instructed Cloudmin, 10 GB. Your image was successfully enlarged..
The difference that I can see is I have a swap partition as vda1 and you use that for /boot.
However your image does not have a swap which is a problem imho.
Ideas?
Submitted by Lucian on Wed, 03/16/2011 - 22:28 Comment #7
I stopped the machine installed from my template (that has a swap partition as vda1), I lvextended it's virtual disk, enlarged partition and filesystem by hand, nothing fancy, pretty standard procedure and it worked. Any ideas why Cloudmin complains?
Let me know if I dont make much sense :)
Submitted by JamieCameron on Wed, 03/16/2011 - 23:05 Comment #8
This is clearly a Cloudmin bug, as the last partition should be extendable in the way you describe.
If you run the command
vm2 list-disks --host your-kvm-vm --multiline
on your Cloudmin master system, what does it output? That will show me what disks and partitions Cloudmin thinks your system has ..Submitted by JamieCameron on Wed, 03/16/2011 - 23:06 Comment #9
By the way, make sure you run that command when the VM is shut down ..
Submitted by Lucian on Wed, 03/16/2011 - 23:16 Comment #10
[root@localhost ~]# vm2 list-disks --host hj45.cloudmin.co.uk
Real file Device on system Type Size
------------------------------ -------------------- ---------- ----------
/dev/vg0/hj45_cloudmin_localdo /dev/vda Device 14 GB
(ignore the cloudmin.co.uk, it's a bogus i set as virtualmin was refusing to install inside the vm without proper hostname).
Submitted by Lucian on Wed, 03/16/2011 - 23:18 Comment #11
Btw, fdisk -l shows this:
fdisk -l /dev/vg0/hj45_cloudmin_localdomain_img
Disk /dev/vg0/hj45_cloudmin_localdomain_img: 15.0 GB, 15032385536 bytes
255 heads, 63 sectors/track, 1827 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/vg0/hj45_cloudmin_localdomain_img1 1 250 2008093+ 82 Linux swap / Solaris
/dev/vg0/hj45_cloudmin_localdomain_img2 251 1827 12667252+ 83 Linux
Submitted by JamieCameron on Wed, 03/16/2011 - 23:24 Comment #12
Sorry, the command should have been :
vm2 list-disks --host hj45.cloudmin.co.uk --multiline
Submitted by Lucian on Wed, 03/16/2011 - 23:57 Comment #13
[root@localhost ~]# vm2 list-disks --host hj45.cloudmin.co.uk --multiline
/dev/vg0/hj45_cloudmin_localdomain_img
Description: LVM VG vg0, LV hj45_cloudmin_localdomain_img
Device on system: /dev/vda
Description on system: VirtIO device A
Format: disk
Type: Device
LVM volume group: vg0
LVM logical volume: hj45_cloudmin_localdomain_img
Storage name: LVM volume group vg0
Storage ID: lvm_vg0
Media: disk
Size: 15032385536
Nice size: 14 GB
Mount point: swap
Mount device: /dev/vda1
Filesystem: swap
Mounted: No
Submitted by JamieCameron on Thu, 03/17/2011 - 00:14 Comment #14
Ok, I was wrong - due to a Cloudmin bug, the order of /etc/fstab does matter. If you put the swap mount at the end, you won't have this problem!
I will fix the underlying bug in the 5.4 release.
Submitted by Lucian on Thu, 03/17/2011 - 00:46 Comment #15
Hi,
Great! I tested and I can confirm it works if I specify swap last in fstab. Another bug squished! :)
Submitted by Issues on Thu, 03/31/2011 - 01:21 Comment #16
Automatically closed -- issue fixed for 2 weeks with no activity.