LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 07-25-2011, 11:12 AM   #1
Zippy1970
Member
 
Registered: Sep 2007
Posts: 117

Rep: Reputation: 17
Question 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?
 
Old 07-25-2011, 12:45 PM   #2
Blue_Ice
Member
 
Registered: Jul 2006
Location: Belgium
Distribution: Debian, Fedora, CentOS, Windows
Posts: 352

Rep: Reputation: Disabled
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.
 
Old 07-25-2011, 02:03 PM   #3
Zippy1970
Member
 
Registered: Sep 2007
Posts: 117

Original Poster
Rep: Reputation: 17
I already have Debian running in Virtual PC. It's just not a copy of my webserver... I will look into the p2v tools.

Last edited by Zippy1970; 07-25-2011 at 02:13 PM.
 
Old 07-25-2011, 05:24 PM   #4
dafydd2277
Member
 
Registered: Mar 2010
Posts: 58

Rep: Reputation: 5
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.
 
Old 07-25-2011, 10:08 PM   #5
jefro
Guru
 
Registered: Mar 2008
Posts: 11,722

Rep: Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445
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.

Last edited by jefro; 07-25-2011 at 10:10 PM.
 
Old 07-26-2011, 04:53 AM   #6
Zippy1970
Member
 
Registered: Sep 2007
Posts: 117

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by jefro View Post
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.
Heh, that's exactly what I'm looking at right now (dd + qemu-img).
 
Old 07-26-2011, 05:19 AM   #7
Zippy1970
Member
 
Registered: Sep 2007
Posts: 117

Original Poster
Rep: Reputation: 17
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?
 
Old 07-26-2011, 05:26 AM   #8
Zippy1970
Member
 
Registered: Sep 2007
Posts: 117

Original Poster
Rep: Reputation: 17
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?
 
Old 07-26-2011, 11:05 AM   #9
Zippy1970
Member
 
Registered: Sep 2007
Posts: 117

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Zippy1970 View Post

So I might get away with just dd-ing the 1st partition (about 1GB), then tar-ing 3, 4 and 5.
Yeah, that will not work since that doesn't copy the boot sector...

So any other solutions?
 
Old 07-27-2011, 12:32 PM   #10
lrtward
Member
 
Registered: Feb 2011
Distribution: CentOS, Ubuntu
Posts: 97

Rep: Reputation: 9
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.
 
Old 07-27-2011, 01:08 PM   #11
Zippy1970
Member
 
Registered: Sep 2007
Posts: 117

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by lrtward View Post
Now I have a nightly rsync job that runs and syncs /var/www/html from my production server to my "play" server.
I had already tried rsync but for some reason it did not work. After the rsync, the installation on the virtual machine gave some weird error and started a BusyBox shell instead.

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):/ /
 
  


Reply

Tags
debian, ghost, webserver


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] When I type "sudo grub" it says "command not found" in Ubuntu 9.10 Live CD. msbstar Linux - Newbie 7 01-30-2010 11:05 AM
Need solution to "failed to fork PTY" and "error creating the child process" problems Gnusboy Linux - Newbie 4 01-02-2010 07:54 AM
Can I make a bootable TAPE using "dd" or "GHOST" from RedHat Enterprise Linux AS 4 rrojo7229 Linux - Server 3 12-20-2007 07:53 AM
SLAX scripts creating live CD based on SimplyMEPIS 3.4 w/ 2.6.15-1: "init not found" lefty.crupps Slackware 1 03-31-2006 07:15 PM
Does "ac97 & RH8" imply "buy a Sound Blaster Live"? nicktoop Linux - Hardware 3 02-13-2004 08:53 AM


All times are GMT -5. The time now is 01:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration