This content has been marked as final. Show 2 replies
I got no replies, but I have found that there seems to be no need to install grub on the disk at all! Xen's magic just makes it work.
Summary of my first email: I was trying to make a duplicate of an Oracle VM virtual machine's primary disk, by simply creating an empty disk, partitioning it, formatting it, and copying files to it. After all that's done, in a "real" situation, you have to (as best I know) install grub on the disk (MBR or partition) so the BIOS can boot it. I was trying to do that, and couldn't make it work.
It turns out that there is no need to do that, at least in the case of PVM machines, because there's no simulated BIOS that has to boot the disk. The booting of the kernel in the VM is done by a program called "pygrub" that runs on the Oracle VM server itself. Pygrub is a part of Xen, apparently. Pygrub simply locates the grub.conf file within the virtual disk, reads it, and initiates the boot of the proper kernel with the proper options. As long as grub.conf is right, the VM will boot.
SO, to create a bootable copy of a virtual machines primary disk, you just need to:
1. Create a disk of an appropriate size.
2. Create partitions and format them. This includes the swap partition.
3. Copy files from the original disk to the new one.
4. Edit /etc/fstab and /boot/grub/grub.conf on the new disk, and change the partition UUIDs to be those for the partitions you created in step 2.
Then you can detach the virtual disk from the machine on which you made it, create a new machine, attach the disk to it, and it boots!
I welcome any (intelligent) comments on the above.
Very, very, very useful post Terry, Thanks!
I've been facing the same situation restore some linux vm's from commvault filesystem backups.
I wonder how long it would have taken me to "just try it anyway" without actually successfully installing grub.
In this case, the problem on existed in my head. Or at least the problem was my ignorance of the XEN boot magic !