I have an old proxy server
uname -a:
Linux proxy 2.6.18-6-686 SMP etc etc
I think it's Debian (I have apt-get).
I've read an interesting article to achieve the virtualization result: http://www.madgenius.com/blog/index....VM-server.html
But this server has different disks:
df -h:
Filesystem Dimens. Usati Disp. Uso% Montato su
/dev/sda1 28G 4,6G 22G 18% /
tmpfs 1015M 0 1015M 0% /lib/init/rw
udev 10M 96K 10M 1% /dev
tmpfs 1015M 0 1015M 0% /dev/shm
/dev/sda2 92M 12M 75M 14% /boot
/dev/sdb2 25G 5,9G 18G 26% /log
/dev/sdb1 9,2G 96M 8,7G 2% /squidcache
It acts mainly as proxy server but it has a LOT of iptables rules. I've tried to save and import in a new server I've prepared, getting only errors (iptables-save and then iptables-restore)
I would like to do a perfect cloning of it and, if possible, virtualize it in a vmware esxi server.
What path should I take?
The first thing you should do, is to replace all the /dev/sdxx-es with UUIDs. Then you'll want to convert those disks to images. That's very easy:
dd if=/dev/sda of=filename_for_sda.raw
. DD stands for Carbon Copy, except that cc was in use by the C Compiler, so they used dd instead. ;) anyway, it takes an input file (if) and copies it to an output file (of). Do not confuse them. Do this for both of your disks, and you'll have a file called "filename_for_sda.raw" and "filename_for_sdb.raw". These are exact representations of the harddisk, including the boot sector, partition tables and everything. So, if you had two disks of the same size you wanted to clone, you could just dodd if=/old_disk/ of=/new_disk
.Now that you have raw images for your disks, you should be able to just add them to most VM solutions and use them. You'll just need to configure it to boot from the correct disk. There are tools to create more fancy types of images, and they should support converting from raw images, as that's the most basic type of image you can get.
dd will copy everything byte for byte, so if you have lots of empty space on the disks, it's not the most efficient solution. rsync might be a good option.