Re: expanding virtual disk based on lvm

2012-09-05 Thread Avi Kivity
On 09/04/2012 09:58 PM, Ross Boylan wrote:
 On Tue, 2012-09-04 at 15:53 +0300, Avi Kivity wrote:
 On 08/28/2012 11:26 PM, Ross Boylan wrote:
  My vm launches with -hda /dev/turtle/VD0 -hdb /dev/turtle/VD1, where VD0
  and VD1 are lvm logical volumes.  I used lvextend to expand them, but
  the VM, started after the expansion, does not seem to see the extra
  space.
  
  What do I need to so that the space will be recognized?
 
 IDE (-hda) does not support rechecking the size.  Try booting with
 virtio-blk.  Additionally, you may need to request the guest to rescan
 the drive (no idea how to do that).  Nor am I sure whether qemu will
 emulate the request correctly.
 
 Thank you for the suggestion.
 
 I think the physical recognition of the new virtual disk size was
 accomplished when I restarted the VM, without any other steps.  I've had
 plenty of other problems, but I think at the VM level things are good.

Certainly restart (shutting down qemu and restarting it, not a reset)
works, I thought you wanted online resize.



-- 
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: expanding virtual disk based on lvm

2012-09-05 Thread Alexandre DERUMIER

Certainly restart (shutting down qemu and restarting it, not a reset) 
works, I thought you wanted online resize. 

You can resize an lvm volume online without restarting the guest.


just use lvextend to extend you lvm volume

then use qmp block_resize command with the same size. (so the guest will see 
the new size)



I have implemented this in the proxmox kvm distribution, and it's working fine.

(tested with virtio-blk and virtio-scsi)



- Mail original - 

De: Avi Kivity a...@redhat.com 
À: Ross Boylan r...@biostat.ucsf.edu 
Cc: kvm@vger.kernel.org 
Envoyé: Mercredi 5 Septembre 2012 09:25:26 
Objet: Re: expanding virtual disk based on lvm 

On 09/04/2012 09:58 PM, Ross Boylan wrote: 
 On Tue, 2012-09-04 at 15:53 +0300, Avi Kivity wrote: 
 On 08/28/2012 11:26 PM, Ross Boylan wrote: 
  My vm launches with -hda /dev/turtle/VD0 -hdb /dev/turtle/VD1, where VD0 
  and VD1 are lvm logical volumes. I used lvextend to expand them, but 
  the VM, started after the expansion, does not seem to see the extra 
  space. 
  
  What do I need to so that the space will be recognized? 
 
 IDE (-hda) does not support rechecking the size. Try booting with 
 virtio-blk. Additionally, you may need to request the guest to rescan 
 the drive (no idea how to do that). Nor am I sure whether qemu will 
 emulate the request correctly. 
 
 Thank you for the suggestion. 
 
 I think the physical recognition of the new virtual disk size was 
 accomplished when I restarted the VM, without any other steps. I've had 
 plenty of other problems, but I think at the VM level things are good. 

Certainly restart (shutting down qemu and restarting it, not a reset) 
works, I thought you wanted online resize. 



-- 
error compiling committee.c: too many arguments to function 
-- 
To unsubscribe from this list: send the line unsubscribe kvm in 
the body of a message to majord...@vger.kernel.org 
More majordomo info at http://vger.kernel.org/majordomo-info.html 
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: expanding virtual disk based on lvm

2012-09-04 Thread Avi Kivity
On 08/28/2012 11:26 PM, Ross Boylan wrote:
 My vm launches with -hda /dev/turtle/VD0 -hdb /dev/turtle/VD1, where VD0
 and VD1 are lvm logical volumes.  I used lvextend to expand them, but
 the VM, started after the expansion, does not seem to see the extra
 space.
 
 What do I need to so that the space will be recognized?

IDE (-hda) does not support rechecking the size.  Try booting with
virtio-blk.  Additionally, you may need to request the guest to rescan
the drive (no idea how to do that).  Nor am I sure whether qemu will
emulate the request correctly.


-- 
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: expanding virtual disk based on lvm

2012-09-04 Thread Ross Boylan
On Tue, 2012-09-04 at 15:53 +0300, Avi Kivity wrote:
 On 08/28/2012 11:26 PM, Ross Boylan wrote:
  My vm launches with -hda /dev/turtle/VD0 -hdb /dev/turtle/VD1, where VD0
  and VD1 are lvm logical volumes.  I used lvextend to expand them, but
  the VM, started after the expansion, does not seem to see the extra
  space.
  
  What do I need to so that the space will be recognized?
 
 IDE (-hda) does not support rechecking the size.  Try booting with
 virtio-blk.  Additionally, you may need to request the guest to rescan
 the drive (no idea how to do that).  Nor am I sure whether qemu will
 emulate the request correctly.
 
Thank you for the suggestion.

I think the physical recognition of the new virtual disk size was
accomplished when I restarted the VM, without any other steps.  I've had
plenty of other problems, but I think at the VM level things are good.

I needed to manually resize the last partition with fdisk.  None of the
other tools (cfdisk, parted, gparted) would manipulate the partition
table, for reasons that became apparent.

The resized partitions were in an mdadm RAID1 array.  When I expanded
them it meant the raid superblock was no longer found (theory), and the
RAID could not be reassembled (fact).  I've attempted to fix that by
recreating the array, but mdadm is refusing to use the UUID I specify,
instead modifying it with the localhost name.  The virtual disks are for
a Debian lenny VM, but the only other spare VM around was squeeze, and
mdadm in squeeze does the localhost rewriting.

By the way, it's really great to have a VM's as a testing area in which
I can discover these problems without trashing my real system.  Thanks
to everyone who made it possible.

Ross Boylan

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


expanding virtual disk based on lvm

2012-08-28 Thread Ross Boylan
My vm launches with -hda /dev/turtle/VD0 -hdb /dev/turtle/VD1, where VD0
and VD1 are lvm logical volumes.  I used lvextend to expand them, but
the VM, started after the expansion, does not seem to see the extra
space.

What do I need to so that the space will be recognized?

The net has references to qemu-resize and virt-resize, but I don't seem
to have them.  The host system is on QEMU emulator version 0.13.0
(qemu-kvm-0.13.0), Copyright (c) 2003-2008 Fabrice Bellard from the
Debian   I'm on lenny (it's the upgrade I'm testing).

The other problem is that everything on the net refers to files that are
disk images; I'm not sure if the same procedures apply when a logical
volume is the underlying device.

The virtual disks each have 3 partitions.  Inside the VM software raid
produces dm0 from the 2 first partitions and dm1 from the 2 third
partitions.

Thanks for any help.
Ross Boylan

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: expanding virtual disk based on lvm

2012-08-28 Thread Freddie Cash
On Tue, Aug 28, 2012 at 1:26 PM, Ross Boylan r...@biostat.ucsf.edu wrote:
 My vm launches with -hda /dev/turtle/VD0 -hdb /dev/turtle/VD1, where VD0
 and VD1 are lvm logical volumes.  I used lvextend to expand them, but
 the VM, started after the expansion, does not seem to see the extra
 space.

You've increased the size of the hard drive, but you haven't changed
the filesystem on top of the hard drive to use that extra space.

How you do that depends on whether the virtual disks are partitioned
with filesystems in the partitions; or formatted with a filesystem
directly.

If they are partitioned, then you need to boot off a LiveCD, extend
the partition, then extend the filesystem in the partition.

If they are formatted directly, then (depending on the filesystem) you
can grow the filesystem.  Some filesystems can't be extended live, so
you have to boot to a LiveCD.

No fancy VM-related tools required.  Just think in terms of real,
physical hardware, and it all becomes clear.  :)
-- 
Freddie Cash
fjwc...@gmail.com
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: expanding virtual disk based on lvm

2012-08-28 Thread Matthew Patton
On Tue, 28 Aug 2012 16:26:38 -0400, Ross Boylan r...@biostat.ucsf.edu  
wrote:



What do I need to so that the space will be recognized?


your partition table for hd{a,b} within the guest is also now wrong. the  
correct way to add more space is to add another disk and then use LVM  
inside the guest to add space to filesystems.



The other problem is that everything on the net refers to files that are
disk images; I'm not sure if the same procedures apply when a logical
volume is the underlying device.


Semantically there is no difference. The guest's view of the disks is  
going to be wrong no matter if the source is a file or LVM item.


--
Cloud Services Architect, Senior System Administrator
InfoRelay Online Systems (www.inforelay.com)
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: expanding virtual disk based on lvm

2012-08-28 Thread Ross Boylan
On Tue, 2012-08-28 at 14:15 -0700, Freddie Cash wrote:
 On Tue, Aug 28, 2012 at 1:26 PM, Ross Boylan r...@biostat.ucsf.edu wrote:
  My vm launches with -hda /dev/turtle/VD0 -hdb /dev/turtle/VD1, where VD0
  and VD1 are lvm logical volumes.  I used lvextend to expand them, but
  the VM, started after the expansion, does not seem to see the extra
  space.
 
 You've increased the size of the hard drive, but you haven't changed
 the filesystem on top of the hard drive to use that extra space.
 
 How you do that depends on whether the virtual disks are partitioned
 with filesystems in the partitions; or formatted with a filesystem
 directly.
The virtual disks are partitioned.
 
 If they are partitioned, then you need to boot off a LiveCD, extend
 the partition, then extend the filesystem in the partition.
So I edit the parition table  directly?  I thought there might be some
meta-information that kvm used to establish the size of the physical
disk.

I'm not sure what the final sector number should be; I could get it
approximately from the size, but I'm not sure my calculation would be
just right.
 
 If they are formatted directly, then (depending on the filesystem) you
 can grow the filesystem.  Some filesystems can't be extended live, so
 you have to boot to a LiveCD.
 
 No fancy VM-related tools required.  Just think in terms of real,
 physical hardware, and it all becomes clear.  :)
My real physical disks have never grown spontaneously. :)  I also wasn't
sure how the kernel would react, and so I shut it down during the
growth.

Ross

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: expanding virtual disk based on lvm

2012-08-28 Thread Freddie Cash
On Tue, Aug 28, 2012 at 2:33 PM, Matthew Patton mpat...@inforelay.com wrote:
 On Tue, 28 Aug 2012 16:26:38 -0400, Ross Boylan r...@biostat.ucsf.edu
 wrote:

 What do I need to so that the space will be recognized?

 your partition table for hd{a,b} within the guest is also now wrong. the
 correct way to add more space is to add another disk and then use LVM
 inside the guest to add space to filesystems.

For incorrect definitions of correct.  :)  Or, at least,
convoluted definitions.  Now you have a filesystem on top of guest-LVM
on top of multiple virtual disks on top of host-LVM on top of multiple
disks.  Instead of just filesystem on virtual disk on LVM on physical
disk(s).

The following has worked for us since the KVM-60-something days:
  Stop the VM.
  Expand the LVM LV used by the VM (on the host side).
  Boot the VM to a LiveCD.
  Modify partition table to use all the extra space in the virtual disk.
  Grow the filesystem to use all the extra space (we only use XFS with
ext3 for /boot, so they expand nicely).
  Boot the VM.
  Enjoy all the extra space.

And, for our Xen boxes that use LVM LV directly (no partition table),
it's possible to do the expansion live with only a single reboot to
pick up the larger disk size:
  Expand the LVM LV used by the VM (on the host side).
  Reboot to get the larger disk size.
  Expand the filesystem live or via single-user mode boot (again, XFS
works wonderfully)

-- 
Freddie Cash
fjwc...@gmail.com
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html