Linux下使用backup-manager配合dar与par进行数据光盘刻录备份
Aug
14
Linux下使用backup-manager配合dar与par进行数据光盘刻录备份
Lijun ZHOU, 2008.08.09
backup manager
OS: CentOS-5
1. download and prepare
http://www.backup-manager.org/download/backup-manager-0.7.7.tar.gz
http://transact.dl.sourceforge.net/sourceforge/dar/dar-2.3.8.tar.gz
http://www.dil.univ-mrs.fr/linux/dil/centos/5/par2cmdline-0.4-14.i386.rpm
## NOTE: bacause the GPL , so cdrtools are not free for linux
## when you use yum , it is are not continue, but we can use below's rpm packages
wget http://ftp.dc.volia.com/pub/CentOS/CentOS/cdrecord-2.01-10.i386.rpm
wget http://ftp.dc.volia.com/pub/CentOS/CentOS/cdrecord-devel-2.01-10.i386.rpm
rpm -qa|grep dvd
yum install dvd+rw-tools
rpm -qa|grep cdr
rpm -ivh cdrecord-2.01-10.i386.rpm
rpm -ivh cdrecord-devel-2.01-10.i386.rpm
2. install
1) backup-manager
tar zxvf backup-manager-0.7.7.tar.gz
cd backup-manager-0.7.7
make install
cp backup-manager.conf.tpl /etc/backup-manager.conf
## edit it for yourself
## NOTE: this config must be noteworthiness
#-------------------------------------------------------------------------
# Where to store the archives
#export BM_REPOSITORY_ROOT="/var/archives"
export BM_REPOSITORY_ROOT="/pkgstore/backupmanager_archives"
# Where to place temporary files
export BM_TEMP_DIR="/pkgstore/backupmanager_temp"
export BM_ARCHIVE_METHOD="tarball"
export BM_TARBALL_FILETYPE="tar.gz"
BM_TARBALL_TARGETS[0]=”/var/log”
export BM_TARBALL_SLICESIZE=”650M”
export BM_BURNING_DEVICE=”/dev/scd0″ ## there you can use cdrecord -scanbus to see the device
#————————————————————————-
2) dar
tar zxvf dar-2.3.8.tar.gz
./configure –prefix=/opt/dar
make
make install
## touch /etc/ld.so.conf.d/dar-i386.conf
/opt/dar/lib
ldconfig -v |grep dar
3) par2
## NOTE: don’t use the official source or rpm package;
## Because those packages are very old , and are not supported to the new system
## So, we use the patch for par2cmdline
rpm -ivh par2cmdline-0.4-14.i386.rpm
3. backup
1) ## if you are not care the data may become unreadable with time and/or bad environment conditions
## you can use backup-manager directly
2) create
## we use par2 to protect the data
## but the backup-manager don’t support the par directly, so we build the par first
(1) CD
cp /opt/dar/share/dar/samples/dar_par_create.duc /appstore/backupmanager_archive/dar_par_create_cd.duc
edit /appstore/backupmanager_archive/dar_par_create_cd.duc
#——————————————————
— exec $PAR c -r$6 -n1 “$1/$2.$3.$4″
+++ exec $PAR c -r$6 -s32768 -l “$1/$2.$3.$4″
#——————————————————
-s32768: means “block size:32768=32k”
## 4.7G DVD 128k=2^17字节 data=3.5G
## 650M CD 32k=2^15字节 data=530M
-l: means “Limit size of recovery files”
## for CD
/sbin/dar –alter=SI -s 535M -z9 -Q -c /appstore/backupmanager_archive/vz.tech.netbig.com-appstore-test_account.20080813.master -E “/appstore/backupmanager_archive/dar_par_create_cd.duc %p %b %n %e %c 20″ -R /appstore/test_account
(2) DVD
cp /opt/dar/share/dar/samples/dar_par_create.duc /appstore/backupmanager_archive/dar_par_create_dvd.duc
edit /appstore/backupmanager_archive/dar_par_create_dvd.duc
#——————————————————
— exec $PAR c -r$6 -n1 “$1/$2.$3.$4″
+++ exec $PAR c -r$6 -s131072 -l “$1/$2.$3.$4″
#——————————————————
-s131072: means “block size:131072=128k”
## 4.7G DVD 128k=2^17字节 data=3.5G
## 650M CD 32k=2^15字节 data=530M
-l: means “Limit size of recovery files”
## for DVD
/sbin/dar –alter=SI -s 3500M -z9 -Q -c /appstore/backupmanager_archive/dar_opt/devel.tech.netbig.com-appstore-mobileserver-gz110-080729.20080813.master -E “/appstore/backupmanager_archive/dar_par_create_dvd.duc %p %b %n %e %c 20″ -R /appstore/mobileserver-gz110-080729/opt
## NOTE:
## 1. -s 535M : means slice 535M
## 2. %p %b %n %e %c 20 : means 20% of redundancy
## in order to the CDR ’s maxsize 650M, and the par 20% redundancy,we use -s 535M for each slice
## if use DVD+R use -s 3500M
3). par-to-par
## select the par file to par2, be sure to the par’s file has a backup if the source par be damaged
11 disk = data (0.8*10) + par (0.2*10) + par-to-par (0.2*10*0.5)
0.5 : means 50% of redundancy
use the 50% of redundancy for par-to-par
## when you complete the par slice, now may be burning to CDR or DVDR
## edit the /etc/backup-manager.conf, close the ARCHIVE_METHOD and open the BURNING_METHOD
export BM_ARCHIVE_METHOD=”none”
export BM_BURNING_METHOD=”CDR”
## now,you can use backup-manager to burning to CD or DVD
4) test
cp /opt/dar/share/dar/samples/dar_par_test.duc /appstore/backupmanager_archive/
/sbin/dar -t /appstore/backupmanager_archive/vz.tech.netbig.com-appstore-test_account.20080813.master -E “/appstore/backupmanager_archive/dar_par_test.duc %p %b %n %e %c 20″ -R /appstore/test_account
4. burning to CD or DVD
edit the /etc/backup-manager.conf
#———————————————————————————
export BM_REPOSITORY_ROOT=”/pkgstore/backupmanager_archives”
export BM_TEMP_DIR=”/pkgstore/backupmanager_temp”
export BM_ARCHIVE_METHOD=”none”
export BM_TARBALL_NAMEFORMAT=”long”
export BM_TARBALL_FILETYPE=”dar”
BM_TARBALL_TARGETS[0]=”/appstore/test_account”
# (usal sizes are 3500 for DVD media and 535 for CDR media)
export BM_TARBALL_SLICESIZE=”535M”
# (usal DVD or CDR media)
# the method of burning archives from the list :
# - DVD : burn archives on a DVD medium
# (that doesn’t need formatting, like DVD+RW).
#
# - DVD-RW : blank the DVD medium and burn archives
# (recommanded for DVD-RW media).
#
# - CDRW : blank the CDRW and burn the whole
# ARCHIVES_REPOSITORY or only
# the generated archives.
#
# - CDR : burn the whole ARCHIVES_REPOSITORY or
# only the generated archives.
# - none : disable the burning system
export BM_BURNING_METHOD=”CDR”
export BM_BURNING_CHKMD5=”true”
export BM_BURNING_DEVICE=”/dev/cdrom”
export BM_BURNING_DEVFORCED=”"
# see mkisofs –help
# -J, -joliet Generate Joliet directory information
# -joliet-long Allow Joliet file names to be 103 Unicode characters
# -jcharset CHARSET Local charset for Joliet directory information
# -l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names
# -max-iso9660-filenames Allow 37 character filenames for ISO9660 names (violates ISO9660)
# -R, -rock Generate Rock Ridge directory information
export BM_BURNING_ISO_FLAGS=”-R -J -l”
## NOTE: your dar’s name will not be longer 37 character,otherwise you will have errors like:
## /usr/bin/mkisofs: Error: xxx and xxx have the same Joliet name
## Operation starts./usr/bin/cdrecord: Premature EOF on stdin.
## /usr/bin/cdrecord: Input buffer error, aborting.
# (usal sizes are 4200 for DVD media and 650 for CDR media)
export BM_BURNING_MAXSIZE=”650″
#———————————————————————————
5. restore
dar -x /pkgstore/backupmanager_archives/appstore-test_account.20080813.1.dar -R /pkgstore/ext/


















No Comments »
No comments yet.
RSS feed for comments on this post. TrackBack URI
Leave a comment
If you want to leave a feedback to this post or to some other user´s comment, simply fill out the form below.