[Fedora-xen] Copying Disk with Xen Partitions (dom0 and domU) to new Disk (machine swap)

John Summerfield debian at herakles.homelinux.org
Mon May 7 23:45:57 UTC 2007


Christian Reiter wrote:
> Hello!
> 
> I have to migrate my Xen Setup from an old machine to a new one.
> The old has one 80GB SATA Disk, the new has one 250 GB SATA Disk.
> 
> This is my partition Table:
> =================Partition Table=================
> [root at m1 ~]# fdisk -l /dev/sda
> 
> Disk /dev/sda: 80.0 GB, 80026361856 bytes
> 255 heads, 63 sectors/track, 9729 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> 
>   Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *           1          13      104391   83  Linux
> /dev/sda2              14        1318    10482412+  8e  Linux LVM
> /dev/sda3            1319        9729    67561357+   5  Extended
> /dev/sda5            1319        5234    31455238+  83  Linux
> /dev/sda6            5235        6480    10008463+  83  Linux
> ============================================
> 
> sda1 and sda2 is dom0
> sda5 is the virtual disk for the first domU
> sda6 is the virtual disk for the second domU
> sda5 and sda6 have their own partion maps as created by virt-manager:
> =================Partition Table=================
> [root at m1 ~]# fdisk -l /dev/sda5
> Disk /dev/sda5: 32.2 GB, 32210164224 bytes
> 255 heads, 63 sectors/track, 3915 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> 
>     Device Boot      Start         End      Blocks   Id  System
> /dev/sda5p1   *           1          13      104391   83  Linux
> /dev/sda5p2              14        3915    31342815   8e  Linux LVM
> ============================================
> 
> 
> What is the easiest way to copy the whole disk (the dom0 and all domUs) 
> to my
> new disk?
> 
> I think a simple "dd if=/dev/olddisk of=/dev/newdisk" won't do the job?

Ordinarily, it does, with some fiddling at the margins. One then 
deletes/recreates the last partition, resizes it etc etc.

_I_ don't see an advantage to dedicating a partition to a guest as you 
have, especially when the guest then partitions it further. You've just 
found a disadvantage:-)

Using dd to copy those guests' partitions to files will work well.

For the others, set up the new disk and use of tar is pretty 
straightforward. You can do it either in one box (maybe the old drive in 
a USB2 enclosure), or on your LAN.

Don't forget to run grub, and a grub CD (see the grub documents) can be 
handy: it boots faster than a normal rescue cd and is all you need if 
only the bootloader's broken.






-- 

Cheers
John

-- spambait
1aaaaaaa at coco.merseine.nu  Z1aaaaaaa at coco.merseine.nu

Please do not reply off-list




More information about the Fedora-xen mailing list