I'm not quite sure how to phrase this question (hence the
poor title), so let me provide an example of what I'm trying to
do.
On my (old) Xen host, I'm able to present
LVM filesystems directly to each guest. These filesystems are actually created and
formatted on the host, and passed directly through. Eg., for one of my hosts using a
separate tmp and swap partitions, I define the storage like
this:
disk = [
/>'phy:/dev/vg1/guest1-swap,sda1,w',
/>'phy:/dev/vg1/guest1-disk,sda2,w',
/>'phy:/dev/vg1/guest1-tmp,sda3,w',
/>]
So, guest1-swap is formatted
as a swap partition, guest1-disk and guest1-tmp are formatted with ext4, and from the
guest's perspective it simply sees them as three formatted partitions under
/dev/sda.
(This may sound like a lot of work,
but there are provisioning scripts, such as the awesome href="http://xen-tools.org/software/xen-tools/" rel="noreferrer">xen-tools,
that automated pretty much everything).
This
provides some really useful capabilities, two of which I'm especially interested in
figuring out for
KVM:
Mount
the guest filesystems from the host OS. I can do a read-only mount of any
guest filesystem at any time, even while the guest is running. This has the side benefit
of allowing my to create LVM snapshots of any existing volume while the guest is
running. This way, I'm able to centrally backup all my guests, while running, from the
host.Online volume
resizing. Because the volumes contain standard Linux filesystems, I can
use a combination of lvextend and resize2fs to grow my guest filesystems, again while
they're
online.
I'm
currently setting up a KVM host that will replace the Xen host. Similar to the Xen setup
I'm leveraging LVM to provide direct filesystem access, but KVM/qemu behaves differently
in that it always creates a image file for the guests, even
on the LVM volume. From the guest's perspective, it sees this as an unpartitioned disk,
and it's up to the guest to apply a partition label, then create the partitions and
filesystems.
From a guest perspective that's
fine, but from a server/management perspective it seems to be far less flexible than the
Xen setup I described. I'm still new to KVM, so I may be (hopefully) missing
something.
I ran into this problem when trying
to re-implement my former backup solution on the KVM host and the mount command chocked
when I tried to mount one of the guest's filesystems. So, addressing that is my current
concern, but it also made me concerned about the resizing thing, because I'm sure that
issue will come up at some point as well.
So,
here are my
questions:
Is
there any way to have kvm/qemu use LVM volume filesystems directly as I described for my
Xen setup? I use libvirt for management if that makes a
difference.If not, what can I do to
get similar mounting/backup functionality under KVM? I've seen discussions about using
libguestfs w/ FUSE to do this, but is that really the best option? I'd prefer to stick
with a native filesystem mount if at all
possible.Also if not, is it possible
to do an online filesystem resize under KVM? I've found several discussions/howtos about
this, but the answers seem to be all over the place with no clear, and definitely no
straightforward,
solutions.
Sorry
for the long post, just wanted to make sure it was clear. Please let me know if I can
provide any other info that would be helpful. Looking forward to the discussion.
:-)
Comments
Post a Comment