Image Not Expanding
Hello, I am running xen with libvirt. I have an image(Fedora12) with xen para virt and run with the help of libvirt. So i wanted to increase the size of this image from 1GB to 2 GB. I am using virt-resize command for this. When i do : virt-list-partitions it displays 2 partitions 1] /dev/sda1 and 2] /dev/sda2 I want to resize this to 2 gb So i do like this: virt-resize --expand /dev/sda1 Fedora12 Fedora12-1 The command executes successfully but when i start the VM its shows old size of the Parttions. Actually from outside its sda1 partition but sincce it is para virt it show xvda1 after VM boot up which still shows old size. Any Ideas on this ? Thanks Vipul
On Mon, Jan 31, 2011 at 01:48:04PM +0530, vipul borikar wrote:
Hello, I am running xen with libvirt. I have an image(Fedora12) with xen para virt and run with the help of libvirt. So i wanted to increase the size of this image from 1GB to 2 GB.
I am using virt-resize command for this.
When i do : virt-list-partitions it displays 2 partitions 1] /dev/sda1 and 2] /dev/sda2
I want to resize this to 2 gb
So i do like this: virt-resize --expand /dev/sda1 Fedora12 Fedora12-1
This looks fine, but what is 'Fedora12-1'? It's presumably a raw disk file. What is its size? What command did you use to create the file? Also please show the full messages that virt-resize printed when you ran the command.
Actually from outside its sda1 partition but sincce it is para virt it show xvda1 after VM boot up which still shows old size.
This doesn't matter. Also make sure you're booting with the new image file, not the old one ... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Thanks for the Respose. On Mon, Jan 31, 2011 at 3:37 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Mon, Jan 31, 2011 at 01:48:04PM +0530, vipul borikar wrote:
Hello, I am running xen with libvirt. I have an image(Fedora12) with xen para virt and run with the help of libvirt. So i wanted to increase the size of this image from 1GB to 2 GB.
I am using virt-resize command for this.
When i do : virt-list-partitions it displays 2 partitions 1] /dev/sda1 and 2] /dev/sda2
I want to resize this to 2 gb
So i do like this: virt-resize --expand /dev/sda1 Fedora12 Fedora12-1
This looks fine, but what is 'Fedora12-1'? It's presumably a raw disk file. What is its size? What command did you use to create the file?
I created Fedora12-1 using this command dd if=/dev/zero of=Fedora12-1 bs=1024k count=2000 it is 2gb disk.
Also please show the full messages that virt-resize printed when you ran the command.
Debug messages show like this: *********************************************** Fedora12 size 1048576000 bytes Fedora12-1 size 2097152000 bytes copying boot loader ... add_drive_ro "Fedora12" add_drive "Fedora12-1" launch Warning: No DNS servers found Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory blockdev_getss "/dev/sdb" part_list "/dev/sda" part_get_bootable "/dev/sda" 1 part_get_mbr_id "/dev/sda" 1 part_get_bootable "/dev/sda" 2 part_get_mbr_id "/dev/sda" 2 pvs_full vfs_type "/dev/sda1" mount_ro "/dev/sda1" "/" statvfs "/" umount_all vfs_type "/dev/sda2" mount_ro "/dev/sda2" "/" umount_all partitions found: /dev/sda1, /dev/sda2 /dev/sda1: bootable = 1 fssize = 928866304 mbr_id = 131 name = /dev/sda1 part_end = 943750655 part_num = 1 part_size = 943718400 part_start = 32256 type = ext3 /dev/sda2: bootable = 0 fssize = undef mbr_id = 130 name = /dev/sda2 part_end = 996179455 part_num = 2 part_size = 52428800 part_start = 943750656 type = swap surplus before --expand or --shrink: 1098776576 (1.0G) Summary of changes: /dev/sda1: partition will be resized from 900.0M to 1.9G /dev/sda2: partition will be left alone part_get_parttype "/dev/sdb" partition table type: msdos list_partitions part_del "/dev/sdb" 2 part_del "/dev/sdb" 1 starting to partition from 64 part_add "/dev/sdb" "primary" 64 3989311 part_set_bootable "/dev/sdb" 1 true part_set_mbr_id "/dev/sdb" 1 131 part_add "/dev/sdb" "primary" 3989312 4091711 part_set_mbr_id "/dev/sdb" 2 130 copy_size "/dev/sda1" "/dev/sdb1" 943718400 copy_size "/dev/sda2" "/dev/sdb2" 52428800 umount_all sync kill_subprocess *********************************************************************
Actually from outside its sda1 partition but sincce it is para virt it show xvda1 after VM boot up which still shows old size.
This doesn't matter.
Also make sure you're booting with the new image file, not the old one ...
Yes i am sure i am booting with new Image file. One more thing i am able to boot the new image but not able to mount it.
Rich.
Thanks Vipul
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones <http://people.redhat.com/%7Erjones> Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Mon, Jan 31, 2011 at 05:04:04PM +0530, vipul borikar wrote:
Debug messages show like this: *********************************************** Fedora12 size 1048576000 bytes Fedora12-1 size 2097152000 bytes copying boot loader ... add_drive_ro "Fedora12" add_drive "Fedora12-1" launch Warning: No DNS servers found Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory blockdev_getss "/dev/sdb" part_list "/dev/sda" part_get_bootable "/dev/sda" 1 part_get_mbr_id "/dev/sda" 1 part_get_bootable "/dev/sda" 2 part_get_mbr_id "/dev/sda" 2 pvs_full vfs_type "/dev/sda1" mount_ro "/dev/sda1" "/" statvfs "/" umount_all vfs_type "/dev/sda2" mount_ro "/dev/sda2" "/" umount_all partitions found: /dev/sda1, /dev/sda2 /dev/sda1: bootable = 1 fssize = 928866304 mbr_id = 131 name = /dev/sda1 part_end = 943750655 part_num = 1 part_size = 943718400 part_start = 32256 type = ext3 /dev/sda2: bootable = 0 fssize = undef mbr_id = 130 name = /dev/sda2 part_end = 996179455 part_num = 2 part_size = 52428800 part_start = 943750656 type = swap surplus before --expand or --shrink: 1098776576 (1.0G) Summary of changes: /dev/sda1: partition will be resized from 900.0M to 1.9G /dev/sda2: partition will be left alone part_get_parttype "/dev/sdb" partition table type: msdos list_partitions part_del "/dev/sdb" 2 part_del "/dev/sdb" 1 starting to partition from 64 part_add "/dev/sdb" "primary" 64 3989311 part_set_bootable "/dev/sdb" 1 true part_set_mbr_id "/dev/sdb" 1 131 part_add "/dev/sdb" "primary" 3989312 4091711 part_set_mbr_id "/dev/sdb" 2 130 copy_size "/dev/sda1" "/dev/sdb1" 943718400 copy_size "/dev/sda2" "/dev/sdb2" 52428800 umount_all sync kill_subprocess ********************************************************************* [...]
The debug output all looks fine. What does the partition table look like from within the resized guest? (ie. fdisk -l ...)
One more thing i am able to boot the new image but not able to mount it.
Did you see this problem? http://libguestfs.org/virt-resize.1.html#guest_boot_stuck_at_grub Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Mon, Jan 31, 2011 at 5:08 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Mon, Jan 31, 2011 at 05:04:04PM +0530, vipul borikar wrote:
Debug messages show like this: *********************************************** Fedora12 size 1048576000 bytes Fedora12-1 size 2097152000 bytes copying boot loader ... add_drive_ro "Fedora12" add_drive "Fedora12-1" launch Warning: No DNS servers found Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory blockdev_getss "/dev/sdb" part_list "/dev/sda" part_get_bootable "/dev/sda" 1 part_get_mbr_id "/dev/sda" 1 part_get_bootable "/dev/sda" 2 part_get_mbr_id "/dev/sda" 2 pvs_full vfs_type "/dev/sda1" mount_ro "/dev/sda1" "/" statvfs "/" umount_all vfs_type "/dev/sda2" mount_ro "/dev/sda2" "/" umount_all partitions found: /dev/sda1, /dev/sda2 /dev/sda1: bootable = 1 fssize = 928866304 mbr_id = 131 name = /dev/sda1 part_end = 943750655 part_num = 1 part_size = 943718400 part_start = 32256 type = ext3 /dev/sda2: bootable = 0 fssize = undef mbr_id = 130 name = /dev/sda2 part_end = 996179455 part_num = 2 part_size = 52428800 part_start = 943750656 type = swap surplus before --expand or --shrink: 1098776576 (1.0G) Summary of changes: /dev/sda1: partition will be resized from 900.0M to 1.9G /dev/sda2: partition will be left alone part_get_parttype "/dev/sdb" partition table type: msdos list_partitions part_del "/dev/sdb" 2 part_del "/dev/sdb" 1 starting to partition from 64 part_add "/dev/sdb" "primary" 64 3989311 part_set_bootable "/dev/sdb" 1 true part_set_mbr_id "/dev/sdb" 1 131 part_add "/dev/sdb" "primary" 3989312 4091711 part_set_mbr_id "/dev/sdb" 2 130 copy_size "/dev/sda1" "/dev/sdb1" 943718400 copy_size "/dev/sda2" "/dev/sdb2" 52428800 umount_all sync kill_subprocess ********************************************************************* [...]
The debug output all looks fine.
What does the partition table look like from within the resized guest? (ie. fdisk -l ...)
fdisk -l gives like this [root@localhost ~]# fdisk -l Disk /dev/xvda: 2097 MB, 2097152000 bytes 255 heads, 63 sectors/track, 254 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000dada5 Device Boot Start End Blocks Id System /dev/xvda1 * 1 249 1994624 83 Linux Partition 1 does not end on cylinder boundary. /dev/xvda2 249 255 51200 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 886M 684M 158M 82% / tmpfs 263M 0 263M 0% /dev/shm It looks like it has increased the disk size. but df shows old size [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 886M 684M 158M 82% / tmpfs 263M 0 263M 0% /dev/shm Do we have to manually do something inside the VM .
One more thing i am able to boot the new image but not able to mount it.
Did you see this problem?
http://libguestfs.org/virt-resize.1.html#guest_boot_stuck_at_grub
Rich.
Grub is having no problem at all it works fine only that i am not able to mount it: mount -o loop,offset=32256 Fedora12-1 /mnt/disk1/ mount: you must specify the filesystem type Thanks Vipul
On Mon, Jan 31, 2011 at 05:30:07PM +0530, vipul borikar wrote:
fdisk -l gives like this
[root@localhost ~]# fdisk -l
Disk /dev/xvda: 2097 MB, 2097152000 bytes 255 heads, 63 sectors/track, 254 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000dada5
Device Boot Start End Blocks Id System /dev/xvda1 * 1 249 1994624 83 Linux Partition 1 does not end on cylinder boundary. /dev/xvda2 249 255 51200 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 886M 684M 158M 82% / tmpfs 263M 0 263M 0% /dev/shm
It looks like it has increased the disk size.
but df shows old size
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 886M 684M 158M 82% / tmpfs 263M 0 263M 0% /dev/shm
Do we have to manually do something inside the VM .
Oh right, I see. Are you using an ancient version of virt-resize (ie. 1.2.<something>)? For these very old versions of virt-resize you do need to manually expand the filesystem inside the VM. Just do: resize2fs /dev/xvda1 In more recent versions of virt-resize, virt-resize itself does this automatically.
Grub is having no problem at all it works fine only that i am not able to mount it:
mount -o loop,offset=32256 Fedora12-1 /mnt/disk1/
mount: you must specify the filesystem type
Not sure what you're trying to do, but try using guestfish: guestfish --ro -i Fedora12-1 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Mon, Jan 31, 2011 at 5:38 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Mon, Jan 31, 2011 at 05:30:07PM +0530, vipul borikar wrote:
fdisk -l gives like this
[root@localhost ~]# fdisk -l
Disk /dev/xvda: 2097 MB, 2097152000 bytes 255 heads, 63 sectors/track, 254 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000dada5
Device Boot Start End Blocks Id System /dev/xvda1 * 1 249 1994624 83 Linux Partition 1 does not end on cylinder boundary. /dev/xvda2 249 255 51200 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 886M 684M 158M 82% / tmpfs 263M 0 263M 0% /dev/shm
It looks like it has increased the disk size.
but df shows old size
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 886M 684M 158M 82% / tmpfs 263M 0 263M 0% /dev/shm
Do we have to manually do something inside the VM .
Oh right, I see. Are you using an ancient version of virt-resize (ie. 1.2.<something>)?
I am using 1.2.14 version CentOS rpms .
For these very old versions of virt-resize you do need to manually expand the filesystem inside the VM. Just do:
resize2fs /dev/xvda1
Done . It worked.
In more recent versions of virt-resize, virt-resize itself does this automatically.
Grub is having no problem at all it works fine only that i am not able to mount it:
mount -o loop,offset=32256 Fedora12-1 /mnt/disk1/
mount: you must specify the filesystem type
Not sure what you're trying to do, but try using guestfish:
guestfish --ro -i Fedora12-1
Rich.
Thank u very much for the response. I will try with never versions also. Thanks Vipul
participants (2)
-
Richard W.M. Jones -
vipul borikar