Cloning a PC to a new HD over the network: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
(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 ...")
 
No edit summary
Line 5: Line 5:
# ensure ssh allows root logins on machine to back up
# ensure ssh allows root logins on machine to back up
# recreate the LVM structure on HD. Ensure there is a non-LVM partition for /boot where we can put the MBR on later
# recreate the LVM structure on HD. Ensure there is a non-LVM partition for /boot where we can put the MBR on later
# also make sure there is an LV or a HD partition for swap
# mount the LVs under /mnt/. First mount root, create the subdirs and then mount the rest
# mount the LVs under /mnt/. First mount root, create the subdirs and then mount the rest
# Sync the data:  
# Sync the data:  

Revision as of 13:59, 15 April 2013

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. also make sure there is an LV or a HD partition for swap
  6. mount the LVs under /mnt/. First mount root, create the subdirs and then mount the rest
  7. 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