[opensuse] Clone an existing webserver into a virtual machine
Dear list, I have a webserver with SSH access only (no physical access). I want to try changes in configuration. I think the easiest way would be setting up a test system, rather than trying on a production system. I'd like to use virtualbox setting up a clone of the webserver. But how do I do? How do I copy the whole files while running the system? How to get the bootloader to my virtual machine, at last? Any ideas? Thanks -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Johannes Nohl skrev:
Dear list,
I have a webserver with SSH access only (no physical access). I want to try changes in configuration. I think the easiest way would be setting up a test system, rather than trying on a production system.
I'd like to use virtualbox setting up a clone of the webserver. But how do I do? How do I copy the whole files while running the system? How to get the bootloader to my virtual machine, at last?
Any ideas?
Thanks
Are you using VMware? If so, use their P2V utility. Last time I did an operation like that, I copied the entire disk to file, then unpacked that file onto a 2:nd disk in the VM. Much like 'dd if=/dev/hdx | gzip > /path/to/image.gz', then unpack with 'gzip -dc /path/to/image.gz | dd of=/dev/hdx' on the VMs 2:nd disk. After that, shut down the VM, take away the 1:st disk and make the 2:nd one the primary. -- Anders Norrbring Norrbring Consulting -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Are you using VMware? If so, use their P2V utility. Last time I did an operation like that, I copied the entire disk to file, then unpacked that file onto a 2:nd disk in the VM.
No, I wanted to use VirtualBox.
Much like 'dd if=/dev/hdx | gzip > /path/to/image.gz', then unpack with 'gzip -dc /path/to/image.gz | dd of=/dev/hdx' on the VMs 2:nd disk. After that, shut down the VM, take away the 1:st disk and make the 2:nd one the primary.
Thanks. This sounds good. But I have a further question: Can image.gz exist on the same partition as the one to clone (or is rawwriting to istself then)? The machine has only one (big) partition. Johannes -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Johannes Nohl skrev:
Are you using VMware? If so, use their P2V utility. Last time I did an operation like that, I copied the entire disk to file, then unpacked that file onto a 2:nd disk in the VM.
No, I wanted to use VirtualBox.
Much like 'dd if=/dev/hdx | gzip > /path/to/image.gz', then unpack with 'gzip -dc /path/to/image.gz | dd of=/dev/hdx' on the VMs 2:nd disk. After that, shut down the VM, take away the 1:st disk and make the 2:nd one the primary.
Thanks. This sounds good. But I have a further question: Can image.gz exist on the same partition as the one to clone (or is rawwriting to istself then)? The machine has only one (big) partition.
Johannes
Nope, that won't work.. dd copies the disk bit-by-bit, so you'd loop it. However, you can redirect the output via scp to save it another box. ;) -- Anders Norrbring Norrbring Consulting -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
However, you can redirect the output via scp to save it another box. ;)
I had a look to scp without redirecting but directly copy from the webserver. Unfortunately scp in opensuse works different than the one in BSDs. It can preserve times (-p) but can't preserve guid. If it could I could make a local install, copy /etc/passwd first, and finally the missing files. Maybe rsync could do it but I'm not familiar with. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Johannes Nohl skrev:
However, you can redirect the output via scp to save it another box. ;)
I had a look to scp without redirecting but directly copy from the webserver. Unfortunately scp in opensuse works different than the one in BSDs. It can preserve times (-p) but can't preserve guid. If it could I could make a local install, copy /etc/passwd first, and finally the missing files.
Maybe rsync could do it but I'm not familiar with.
Well, I meant that you should pipe the dd output through ssh, not the file system. Something like this; dd if=/dev/hdx bs=8k | gzip -1 | ssh user@host dd of=/path/disk.dd.gz bs=8k Substitute values as needed.. ;) Then you'll have a compressed complete disk image on the receiving host. Anders -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Anders Norrbring
-
Johannes Nohl