Is it possible to clone an instance, or perhaps create empty instances
and disks that I can then dd into or mount up and rsync?
Tried searching the list but couldn't find anything to do with cloning
Thanks!
Nope :)
What you want is a gnt-instance add --no-install, which should be
trivial to do, but it's not yet there...
iustin
Could I create another OS instance script that just does the
partitioning, but doesn't debootstrap etc.. suppose that would work?
Sure. Or you could wait for 2.1.2 which will allow creation of instances
based on existing LV volumes.
iustin
> > Is it possible to clone an instance, or perhaps create empty instances
> > and disks that I can then dd into or mount up and rsync?
>
> > Tried searching the list but couldn't find anything to do with cloning
Hi,
we need to do this all the time :) 2 ways :
- when you have an instance ready to be a source for cloning, use gnt-
instance export,
then, to create the clone, use gnt-instance --import
- If you want to use dd: when you have an instance ready, shutdown
it, then :
- gnt-instance activate-disk yourinstance
it will display the node/drbd device used, for ex foo2.node.gnt:/
dev/drbd33, so :
ssh foo2 "dd if=/dev/drbd33 of=mysystem.iso"
- to recreate it, add a vm with gnt-instance add, then shutdown
it, activate-disk ,and dd.
NOTE : the first way will update hostname, network etc (if needed),
but don't work atm with full-virt vm (on a kvm cluster) (a bug is
opened for this).
The second will work for everything, but you will need to update
hostname / remove /etc/udev/rules.d/persistent-net.rules / update
network if static ip yourself.
Regards.
Maxence
Thanks for this will try it out...
Will also investigate the rsync route too as I'd like to do some
remote P2V migrations if possible. I'm sure it is with a little elbow
grease :)
Iustin: Very cool on the new feature, look forward to it
The idea is the same as for dd, create a basic vm, shutdown, activate-
disk, then :
{{{
kpartx -av /dev/drbd33
mkdir /mnt/mountpoint
mount /dev/mapper/drbd33p1 /mnt/mountpoint
}}}
and after your rsync :
{{{
umount /mnt/mountpoint
kpartx -dv /dev/drbd33
}}}
Works great! Thanks for sharing.
Just done a proof of concept move of one of our webmail servers.. All
is well :)
Sweet, I was hoping an option like that would be available at some
point. I'm assuming it'll only setup the disks and nothing more? Is
there a issue open for that yet? I'd like to track its progress.
Cheers-
--
Lance Albertson
Systems Administrator / Architect Open Source Lab
Network Services Oregon State University
We're in the process of starting to migrate all of our virtual machines
from our old non-ganeti xen cluster onto a new ganeti cluster in the
next coming weeks. This isn't quite the same situation that you're in
but I thought I'd at least mention it here.
The process we're going to use basically is this:
1. Create LVM snapshot of the current VM
2. Create filesystem dump using dump from the snapshot
3. Create empty instance on the Ganeti cluster
4. Restore dump on Ganeti cluster (activate-disks, kpartx, mount, etc)
5. Shutdown VM on old cluster, create an incremental filesystem dump
6. Restore incremental backup (re-run grub if needed)
7. Start VM on Ganeti
This provides us a migration plan with the lowest downtime for the VMs
(usually under 5-10min). Using dump instead of rsync is great because
it'll preserve almost everything including SELinux labels and ACLs (if
you're using them). It'll also only copy the files and directories you
need instead of whole blocks like dd does.
No, there isn't, I'd appreciate if you file one :)
iustin