Suse 7 vServer Clone to Live CD?

T.Dalton

New Member
Is it possible for a linux novice to clone a running vserver copy, download and manipulate it in such a way that it runs as a live cd, i.e. as bootable system?
I image that this would involve a live cd of the os in question, and the an image of all the configuration files of the running server plus all the user data. Is this true or is there so much more involved?
Any input would be great!
 
Uh oh, that's going to be a little bit tricky. I've never done that before but I think it is doable (I did it only the other way around: I converted a separate system into a vServer).

I can't tell you how to convert that system into one that will directly run off a bootable CD-ROM. However, as it's much easier to create that system inside a virtual computer (e.g. VMWare), I'll tell you how to do that and once you have this clone running you might be able find some tutorial how to convert it into a Live CD.

The required steps are essentially as follows:
  1. Install VMWare Server (downloadable for free from VMware: Virtualization, Virtual Machine & Virtual Server Consolidation - VMware) on your local computer
  2. Create a virtual machine in VMWare and install Linux (same distribution that is running on vServer). Use only a single partition for data and another one for swap space. Configure it and make sure it is running well in the virtual environment.
  3. Boot the virtual machine using the Linux installation CD and choose the rescue mode (or use any other Live CD)
  4. mount the virtual machine's hard disk to access the installed Linux. Save /etc/fstab (this will be /mnt/etc/fstab if you mounted the virtual disk's data partition to /mnt) and the network settings.
  5. cd /mnt
  6. mkdir original_installation
  7. move all subdirectories except proc, dev, and sys to the created directory "original_installation". It is good to keep those if the transfer does not work on the first attempt....
  8. [on the vServer]terminate all programs; pack all directories except proc, dev, and sys using "tar" and transfer the archive to the virtual machine; (restart the processes)
  9. [back on the virtual computer] unpack the tar-archive in /mnt
  10. restore fstab and the saved network settings.
  11. mount --bind /proc /mnt/proc;
  12. chroot /mnt /mnt/bin/bash
  13. edit /etc/hosts to use the virtual machines IP address for the host name of the vServer
  14. now you should be able to start some programs...
  15. reboot the virtual machine (w/o the install CD)
  16. login via ssh to the virtual machine
  17. Once everything's running well you can delete /original_installation
Now you should have a system that is as close to the vServer as possible. It will have different network settings and some other programs might need some tuning to work with the different IP address. You will discover some more differences, i.e. the virtual machine will show other hardware characteristics than the vServer and might give access to devices (like tun/tap) that are not available on the vServer, etc.

Cheers,
LinuxAdmin

PS: I've written this "tutorial" right out of my head -- some steps might be missing; Use at your own risk ;)
 
Most state of the art systems are able to boot from DVD. Once the vServer is successfully transfered to the local VMWare environment he is able to strip any content of the volume to an additional medium.

A discussion concerning the size of the vServer volume can follow once the vServer is transfered successfully.

--marneus
 
Thank you all or your answers!!
I am not able to boot from DVD.
I think it will be easier to just mirror the system and bring an external harddrive or stick or something from which i can boot or use some virtual hosting software to boot. This is a great tip, thank you LinuxAdmin!

I will try and follow your instructions, but i already have 1 question:
[on the vServer]terminate all programs; pack all directories except proc, dev, and sys using "tar"
This is not as easy as it sounds. do i type tar -cf /all ???
 
Code:
tar -C / -cf /tmp/system.tar bin boot dev etc home initrd lib media mnt opt root sbin srv usr var
should do the trick. Or use
Code:
tar -C / -cf - bin boot dev etc home initrd lib media mnt opt root sbin srv usr var | ssh virtual_computer "tar -C /mnt -xplf -"
to directly transfer the data to the virtual computer and unpack them in /mnt.
 
Back
Top