Creating a "ghost" of a live webserver?
I would like to run a copy of my live webserver in a Virtual PC on Windows so whenever I need to install new stuff on my webserver, I can "practice" first on the virtual copy.
It doesn't need to be an exact copy: I'm not really interested in having a copy of all domains on the webserver. Is there a way to do that without having to take the webserver offline? |
You could use a p2v tool to create an image, but you need to read up on the possibilities for Virtual PC. I don't know how Virtual PC works.
|
I already have Debian running in Virtual PC. It's just not a copy of my webserver... I will look into the p2v tools.
|
Do you keep your web servers under version control? How about your apache configuration files? If so, you can just check out the files into the virtual, and maintain good copies back and forth.
|
A p2v may help but not really needed. A dd of the drive ought to create a raw file, then use qemu-img to convert to a vpc hard drive format.
Almost any clone type of deal should work also. You can clone it to a file or set of files then make a new vm. Then boot to some live media to return the files to the new blank drive. Use any tool for an real machine. A vm is no different. If it is already a virtual machine then just copy it to some place and run it from there but be sure to disable network before you boot it. |
Quote:
|
Ok, I actually started to create a ghost using dd until I realized this isn't going to work. My webserver is actually in a data-center - a two hour drive from where I live. The disk I want to ghost is 160Gb in size, meaning the image will be 160Gb as well. I realize I can compress this with gzip/bzip but that will still leave me with a file at least 70GB in size (that's the total size of files I know it can't compress any further (zip files, jpgs, etc).
I have a very fast internet connection at home so I should be able to download that in about 2 hours. Only problem is, that will eat up precious datatraffic from my server (I have a 500Gb monthly limit). There's a lot on that drive I'm simply not interested in. Entire folders containing huge zip files or thousands of images. If I somehow can exclude those, I'm sure that what's left will not be larger than a few GB. So is there another way besides dd/qemu-img? |
Hate to make this a one-man-show but I also just realized the drive has 5 seperate partitions:
1: / 2: /usr <- contains all hosted domains and the bulk of the data on the drive 3: /home 4: /var 5: /tmp So I might get away with just dd-ing the 1st partition (about 1GB), then tar-ing 3, 4 and 5. Right? |
Quote:
So any other solutions? |
I have a similar setup and I installed apache, php, mysql, etc. on my "play" server. Got it all configured.
Now I have a nightly rsync job that runs and syncs /var/www/html from my production server to my "play" server. You can easily exclude portions of the website (videos, documents, etc.) with rsync so that you're not moving too much data. |
Quote:
This is what I used: Code:
rsync -vrpoglHDIt --exclude=/proc --exclude=/sys --exclude=/tmp --exclude=/etc/fstab --exclude=/usr/mysql --exclude=/usr/domains --exclude=/usr/backups --exclude=/var/cache --exclude=/var/log --progress (my webserver's IP):/ / |
All times are GMT -5. The time now is 10:41 AM. |