first full-sync
On drupal-dev (rentre.tld):
#if it exists lvremove all/drupal-dev-snapshot #Create the snapshot #Before doing this, ensure nobody is working on the vm #It will take only a few seconds, then people can continue to use the vm lvcreate -L1G -s -n drupal-dev-snapshot /dev/all/drupal-dev
On z2 ganeti master :
#We supposed a drupal-clone vm is created, 10G disk ganeti-master:~# gnt-instance shutdown drupal-clone.vm.gnt #Ganeti will print some path informations after this command ganeti-master:~# gnt-instance activate-disks drupal-clone.vm.gnt # ganeti output : z2-4.host.gnt:disk/0:/dev/drbd8
On z2 instance's primary node (z2-4 in previous example):
z2-4:~# ssh root@rentre.tld "dd if=/dev/all/drupal-dev-snapshot" | dd of=/dev/drbd8 z2-4:~# kpartx -dv /dev/drbd8
On z2 ganeti master :
ganeti-master:~# gnt-instance deactivate-disks drupal-clone.vm.gnt
sync existing vm with rsync
On z2 ganeti master :
#We supposed a drupal-clone vm is created, 10G disk ganeti-master:~# gnt-instance shutdown drupal-clone.vm.gnt #Ganeti will print some path informations after this command ganeti-master:~# gnt-instance activate-disks drupal-clone.vm.gnt # ganeti output : z2-4.host.gnt:disk/0:/dev/drbd8
On z2 instance's primary node (z2-4 in previous example), first make sure with vgs that there is no "debian" group active already.
z2-4:~# mkdir /mnt/drupal-clone z2-4:~# kpartx -av /dev/drbd8 z2-4:~# vgscan z2-4:~# vgchange -ay z2-4:~# mount /dev/debian/root /mnt/drupal-clone/ #assuming you put the ssh key on drupal-dev.rentre.tld #no need to sync /boot which is mounted on another partition z2-4:~# rsync --delete --numeric-ids -avHz --exclude=*.iso --exclude=/proc --exclude=/boot --exclude=/sys root@drupal-dev.rentre.tld:/ /mnt/drupal-clone/ > /root/drupal-clone.log 2>&1 z2-4:~# umount /mnt/drupal-clone z2-4:~# vgchange -an z2-4:~# kpartx -dv /dev/drbd8
On z2 ganeti master :
ganeti-master:~# gnt-instance deactivate-disks drupal-clone.vm.gnt