LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 05-02-2008, 10:54 AM   #1
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 44
backup server for upgrade.


I have some Fc2 servers that I am upgrading to CentOS
using this How To I made
http://www.linuxquestions.org/questi...-2ways-639140/



My question is.. What's the best way to back up this system incase the upgrade goes horribly wrong? I have looked at dd and rsync but I am not sure how to use them in my case.

Setup:
Fc2 server
Needs to be backedup incase of failure
Not sure how to phrase this: But I need the back up to be a total system backup, all the rpms, files, users, etc. If the upgrade goes bad.. I need a way to put the server back together exactly as it was prior to the upgrade.

The FC2 servers are on a private subnet with a server available to store the backup data.


Any pointers? thanks!


j
 
Old 05-02-2008, 06:48 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Won't your regular backup handle this situation? How do you put one of your servers back together now when you have a disaster?

---------------------
Steve Stites
 
Old 05-03-2008, 06:02 PM   #3
ComputerErik
Member
 
Registered: Apr 2005
Location: NYC
Distribution: Debian, RHEL
Posts: 269

Rep: Reputation: 54
I am not a Linux guru, but I would use DD to create an exact image on a spare hard drive large enough to hold all of the data. Then in the event of problems that require you to fall back to the known good setup just connect that drive and reboot.
 
Old 05-03-2008, 07:43 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'd second the dd option - boot a live CD and copy any relevant partitions
 
Old 05-04-2008, 11:37 AM   #5
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 44
thanks for the suggestions.

The problem is.. I just walked into this job and the person who previously maintained these servers isn't available to help me. I didn't set these servers up and I have no idea what the backup plan currently is. And I'm not really interested in having these upgrades go bad and not having my own plan for recovery.


For the first 2 servers I am upgrading, the harddrives are only about 2GB of data that needs to be saved, so I just changed to runlevel 2, ran a cpio command to back up the directories(etc,home,usr,var) into a tar file and moved the files to a different server.


Using dd, if say the HD is 40 GBs but only 2 GB is in use, would dd only copy the 2GBs of data does it write the entire 40GBs?

Also they are rackmounted servers with no CD/DVD drive. I guess I could take a USB CD/DVD and boot up using that..
 
Old 05-05-2008, 12:55 AM   #6
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
Quote:
Originally Posted by ncsuapex View Post
Using dd, if say the HD is 40 GBs but only 2 GB is in use, would dd only copy the 2GBs of data does it write the entire 40GBs?
It will copy the whole partition. So if the 40gb has been split in to smaller partitions, you will be able to copy each partition individually.

Quote:
Originally Posted by ncsuapex View Post
Also they are rackmounted servers with no CD/DVD drive. I guess I could take a USB CD/DVD and boot up using that..
As long as the server supports booting from USB-CD, which it should since the O/S got on there somehow
 
Old 05-05-2008, 01:34 AM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Or you could pipe it through a compressor if size is an issue
 
Old 05-05-2008, 01:39 AM   #8
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
Quote:
Originally Posted by billymayday View Post
Or you could pipe it through a compressor if size is an issue
Not if you want to dd it to a file, then be able to mount the file using:
Code:
mount -o loop,ro /mnt/backupDrive/old-partition.dd.iso /mnt/old-partition
If you mount the drive that way, you can browse and selectively restore files without having to worry about damaging your backup (it's mounted read only). For extra protection, change the old-partition.dd.iso file permissions and/or make it immutable:
Code:
chmod 400 /mnt/backupDrive/old-partition.dd.iso
chattr +i /mnt/backupDrive/old-partition.dd.iso
To create this, you would use:
Code:
dd if=/dev/sda1 of=/mnt/backupDrive/old-partition.dd.iso
Where /dev/sda1 is the partition to backup.
 
Old 05-05-2008, 02:33 AM   #9
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Agreed, but he's more likely to want to restore the whole partition, I don't think he'll be looking for a couple of lost files.

Cheers
 
Old 05-05-2008, 02:52 AM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If the partition has the patterns of deleted files on it, it won't compress very well. You can however use dd to create a file of null characters almost equal to the size of the drive, and then delete that file before using dd & bzip2 to backup and compress the image. Doing this you will get an image around 2GB in size instead of an image around 30GB.
Code:
example:
df /dev/sda6
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda6             59502428  23134872  33344928  41% /
> sudo dd if=/dev/zero of=/boot/zeros bs=1024 count=33344926
> sudo rm /home/zeros
The dd command can take a very long time to got through a large partition. From another shell (e.g. another pseudo terminal) you can enter "sudo kill -SIGUSR1 <dd pid>" where <dd pid> is the process ID of the dd command. Dd will then output on stderr of the first shell, the current progress. This allows you to track the progress in case you think there might be a problem. The SIGUSR1 signal is what you use in Linux. Another *nix may use another signal.

Last edited by jschiwal; 05-05-2008 at 02:54 AM.
 
Old 05-05-2008, 08:39 AM   #11
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 44
Quote:
Agreed, but he's more likely to want to restore the whole partition, I don't think he'll be looking for a couple of lost files.

correct. I'd like to be able just to restore the entire system as it was prior to the upgrade. At least with the cpio command I have the files and I could just reinstall the OS and copy the DIRs over..

find /home | cpio --create --format=tar > /misc/home.tar


I did this in runlevel 2 so that should be ok right?

df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 55G 4.0G 48G 8% /
/dev/md1 124M 14M 104M 12% /boot
none 2.0G 0 2.0G 0% /dev/shm


is the filesystem of the 2 servers I am currently working on. Other servers have 30+ GBs of data that I would need to restore.
 
  


Reply



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
Effective Backup and Upgrade of Samba Vald0r Slackware 4 11-16-2007 12:16 PM
Using RSync to backup a secondary off-site backup server pezdspencer Linux - Software 4 06-29-2007 03:40 PM
LXer: Backup MySQL databases, web server files to a FTP server automatically LXer Syndicated Linux News 0 08-11-2006 09:54 PM
Hard Drive upgrade - proper procedure for backup? cwa107 Linux - Newbie 2 06-22-2006 08:13 AM
Solaris 10 Upgrade - Generating Backup List btmiller Solaris / OpenSolaris 1 02-21-2005 01:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:11 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration