Server Upgrade and Backup Questions


Recommended Posts

Good Morning all ;)

As many of you know, I have had a linux presence on the web on Buddy-Baker.us (BBUS) The original server was an IBM netfinity with SCSI drives and she has served me well. Starting in about February 2010, both Dan and I began noticing that the server (Heather) was not staying UP longer then maybe 3 days before she would power off. After checking the server, the server room power, the UPS's and finally the power cords to the server, it was determined that the server was shutting itself down, because it would do it every hour after awhile, then it went to about every 15 minutes.

Dan told me that we could change Heather to a more stable server, with Half Terabytre of drive space, and this would eliminate alot of the problem, and we had servers that could take the data that is currently hosted on the server - We had to move some data to another server, which I completed last week. He will give me the 500 GB server for Heather to populate, so the only thing left to do is bring the servers to me, or do this at the office.

My Problem: I have data in /etc, /var, /home, and other directories that are under these. I have a fully functional copy of BBUS in /var/www/ and other files there as well - and I really dont want to lose this data, the users, groups, passwords, etc. Is there an easy way to grab this data, tar it up, then make a directory that has all of this data in the root of my WD 1 TB drive, and move it over where I can then fire new server up, install Lenny, then manipulate the data so I can have a working system?

The BIG problem being that the IBM server may NOT stay UP long enough for me to do this work, so hopefully, I have tarballs I can move quickly - If it works, I can move some directories - I have a 320 MB WD drive connected to Heather Now, that actually has some files, but may not have backups of what I need - and I would like to move these files easily.

Does anyone have an idea how I can attack this easily?

Thanks,

Brian

Link to post
Share on other sites

Assuming the old machine works (at all), has rsync installed, and the new drive is mounted under /mnt:

# rsync -aHA --exclude=/mnt/ --exclude=/dev/ --exclude=/proc/ --exclude=/sys/ / /mnt

should create a copy of the entire system, sans excluded directories, under /mnt/. You might have to fiddle with the options a bit to get exactly what you want. If you're sure that everything you need is under /etc, /home, and /var, you can --exclude everything else or just rsync each of those directories individually:

# rsync -aHA /var /mnt
# rsync -aHA /etc /mnt
# rsync -aHA /home /mnt

Note that leading and trailing slashes on the directories in all of these rsync commands are important. Also, the -H and -A options probably aren't necessary and slow down the process but I included them just in case.

If the system goes down while the copy in progress, you can just run the same command again and rsync will pick up where it left off.

If rsync isn't installed or you don't want to deal with it, you can kind of do the same thing with cp -a. The main problem is that cp might not deal with a sudden shutdown as well as rsync; while cp does take -u option that tells it update the destination instead of blindly copying everything, I don't think it'll catch files that were only partially copied (it only checks timestamps whereas rsync checks timestamps, file sizes, and optionally checksums doesn't matter, it looks like the timestamps aren't reset until the copy is complete, so cp won't even try to update the partial files).

If you want to use tar you'll have to figure it out yourself ;) I haven't used tar in ages. You might need to build up the tarball(s) incrementally as the system reboots.

You might want to dump any databases, for example with mysqldump, just on the off chance that something goes wrong, if you can do it quickly enough.

Once the data is safely copied you'll have to fix the file owners. You can either set the user and group id numbers on the new system to match the old system or run around chowning everything. If you prefer the second option,

# find /mnt/ -printf "%p\t%u:%g\n"

will print the symbolic owner and group of all of the copied files in tab-separated format for reference.

Link to post
Share on other sites

Jcl:

Thanks for that information - I am not sure how long the IBM server will stay up, but I am willing to try anything to get this data over there. Even if I have to manually create logins, groups and some passwords, at least that way I can read the info using nano ;) I will keep you advised as we move forward ;)

Brian

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...