Cloning a PC to a new HD over the network

From Edgar BV Wiki
Revision as of 15:08, 9 April 2013 by Red (talk | contribs) (Created page with "This method works if you want to clone a server to a new virtual machine # mount HD in VM (rightclick VM, edit settings, 'add' new device and create a new HD) # ensure rsync ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This method works if you want to clone a server to a new virtual machine

  1. mount HD in VM (rightclick VM, edit settings, 'add' new device and create a new HD)
  2. ensure rsync is on both machines
  3. ensure ssh allows root logins on machine to back up
  4. recreate the LVM structure on HD. Ensure there is a non-LVM partition for /boot where we can put the MBR on later
  5. mount the LVs under /mnt/. First mount root, create the subdirs and then mount the rest
  6. Sync the data:
 rsync -a -h --stats --exclude=/home/sites/www.cmtportal.nl/site/zuilen/upload/ --exclude=/home/store/ --exclude=/proc/ --exclude=/sys/ --exclude=/dev/ -e ssh root@192.168.0.9:/ /mnt/

(NB find HD UUID's using blkid)

  1. edit the /mnt/etc/fstab to reflect the new LV names
  2. vi /boot/grub/menu.lst or grub.cfg to reflect the new LV names
  3. mkdir /var/, /sys/, /dev/
  4. unmount the LV's
  5. remove the HD from VM and add this to new VM
  6. start up on rescue disk
vgscan
lvscan
vgchange -ay
mount -a
update-grub
grub-install /dev/sda
update-initramfs -u -k all
sync
exit

reboot (unmount the cd from the VM)

  1. mount all drives
  2. Install grub bootloader
update-grub
grub-install /dev/sda