Re: DUMP script ..



Hi,

Having a general dump script is fairly tricky because dump wants you to
specify partitions based on their device name. e.g., /dev/hda1
/dev/hda2

Nonetheless, here's my dump script that I use to back up several
different Redhat and Fedora machines, and one ancient HP C180. It is
not intended to be elegant and there's absolutely no guarantee that it
works. I dump to an nfs mounted remote disk. I created it when I
was learning perl, so please excuse the horrible perl coding also.

You need to inspect and replace the lines containing: "$machine =~
m/<foo>/" "@parts = " (these are the partitions that you want to
backup) "$hold_path" (this is where the dumpfiles will go). It
creates customized filenames based on the machine being dumped, the
partition that got dumped, the date, and the dumplevel. I had to split
the dumpfiles because they were over 2 GB, and the older OSes couldn't
see the files over 2 GB easily. So the "| split" line near the end
splits it into 2 GB files. So you'd end up with foo.dumpaa,
foo.dumpab, ..., foo.dumpba, foo.dumpbb, ..., foo.dumpzz. To
recombine these files to a workable dump file: "cat foo.dumpaa
foo.dumpab ... foo.dumpzz > foo.dump"

Follow the man pages for appropriate flags.

--BEGIN--
#!/usr/bin/perl
# 2/16/2005 - BTJ
# This program makes a level $dumplevel backup of the files on this
$machine
# to a file $hold_path/$file_name on the holding disk.

# Basic instructions:
# Chose the $dumplevel and $type below depending on which dumplevel you
want
# and where you want it to go.

# --- backup dependent settings (chose right stuff!):
$dumplevel = "0";
$type = 'disk';
# ---

$machine = `hostname`; # no need to modify this, except for meso (?)
chop($machine);
print($machine);

if ($machine =~ m/meso/) {
@parts =
("vg00/lvol1","vg00/lvol3","vg00/lvol4","vg00/lvol5","vg00/lvol6","vg00/lvol7","vg00/lvol8","vg00/lvol9","vg01/lvol1","vg01/lvol2","vg01/lvol3
","vg02/lvol1");
$hold_path = "/ide6/backups";
} elsif ($machine =~ m/graupel/) {
@parts = ("hda1","hda5","hda3","hda2");
$hold_path = "/ide4/backups";
} elsif ($machine =~ m/vapor/) {
@parts = ("hdb1","hdb2","hdb5");
$hold_path = "/ide3/backups";
} elsif ($machine =~ m/cloud/) {
@parts = ("sda1","sda5","sda6","sda8");
$hold_path = "/ide5/backups";
} elsif ($machine =~ m/rain/) {
@parts = ("sda1","sda5","sda6","sda8");
$hold_path = "/ide6/backups";
}

# if we're backing up meso (HP C180), dump is different....
if ($machine =~ m/meso/) {
$flags = $dumplevel."udsf 40000 40000"; # arbitrary values, need to
be long enough to accomodate /data (largest) partition on one "virtual
tape" when d
umping to disk
} else {
$flags = "-$dumplevel -a -u -f";
}

($day, $month, $year) = (localtime)[3..5];
$month++;
if ($month <= 10) {$month = "0$month";}
if ($day <= 10) {$day = "0$day";}
$year = $year + 1900;
$dat = "$month$day$year"; #today's date

#Remove old dump files, you may want to modify this also, depending on
your dump strategy.
@allfiles = <$hold_path/$machine\_L*>;

foreach $file (@allfiles) {
print "`rm -f $file`\n";
`rm -f $file`;
}

# loop over $partitions
if ($type =~ m/disk/) {
foreach $part (@parts) {
($partn1,$partn2) = split(/\//,$part);
$partn = $partn1.$partn2;
$filename =
$machine."_"."L".$dumplevel."_".$partn."_".$dat.".dump";
print "`nice dump $flags - /dev/$part | split -b2000m -
$hold_path/$filename`\n";
`nice dump $flags - /dev/$part | split -b2000m -
$hold_path/$filename`;
}
}

--- END ---

LB wrote:
Hello all ..

I'm looking for a script that will utilize the DUMP command and can
completly back up a CentOS system in the event of a hard drive failure
using the restore command. This dump will not be done to tape, but to
another hard drive in the box. I will then have the dump archive moved
to a samba share where it will be backed up.

I can do all of this with the execption of the the DUMP script. :-P
figured i'd add some humor to the post .. But .. there are many scripts
on the net all over the place. But I think this would work,
http://dinsen.net/netbsd/dump but will this dump script recover my
system completly in the event of a hard drive failure?

I found one Gentoo script, but its very aimed toward Gentoo and Gentoo
is very different then other linux systems so I decided not to try it:
http://blinkeye.ch/mediawiki/index.php/GNU/Linux_System_Backup_Script_%28stage4%29

I just need a script that can basically backup a whole system and can
be restored just as easilly. The system is up and running as I said its
CentOS and its running at full opertation and live.

Any help is appreciated.

GNY

.



Relevant Pages

  • Re: DUMP script ..
    ... Having a general dump script is fairly tricky because dump wants you to ... specify partitions based on their device name. ... partition that got dumped, the date, and the dumplevel. ...
    (comp.os.linux.misc)
  • Restore command Issue
    ... I have been running a dump script for a while which should do a full dump ... Could someone tell me why some of the files might not be extracting? ... This transmission is confidential and must not be used or disclosed by ...
    (RedHat)
  • Re: backups & cloning
    ... dump unmounted file systems to the system's tape drive. ... The restore program, on the other side of the | pipe, does ... Here's an example (ad1 is source disk, ... Use dump only on unmounted partitions. ...
    (freebsd-questions)
  • Re: backups & cloning
    ... will the s1a slice dump the entire system, that is, the a, d, e, f ... you cannot dump slices. ... partitions only, or, in other words, the dump program does ... PCs do only support 4 slices per disk. ...
    (freebsd-questions)
  • RE: Areca Weirdness
    ... the Areca is additional storage) and it died again running ... Dump header from device /dev/ad0s1b ... Am I expecting too much with partitions over 2Tb? ... major issues with it on Linux/386 with large memory support ...
    (freebsd-stable)