Re: Imagen de disco en Debian
On Tuesday 02 January 2007 17:01, Mike McCarty wrote:
> This guy has a server, which he needs to move. He wants to make a
> clone of the disc, so as not to run the risk of damaging his only
> good disc.
> > al primero que tenga una imagen del mismo y hacer backups diarios
> > para tenerlos sincronizados: en caso de que se rompa el primer
> > disco tengo la opcion de colocar el segundo como primario y listo.
> It isn't clear if he wants an exact image. He's saying he wants to
> make daily backups to the new disc.
Over Christmas I had to upgrade my wife's computer from Windows 98 to
Windows XP. Before starting I knew I was going to move partitions
around and wasn't sure if the upgrade would loose any other data.
So I booted a system rescue cd (see http://www.sysresccd.org/Main_Page),
loaded up a firewire external drive (I bought the enclosure and put an
old 20G drive in it) and then used
dd if=/dev/hda of=/dev/sda bs=512
to do a bit copy of the whole drive.
I had to restore a couple of times (moving partitions which have a boot
sector pointing to them does not work well), and did the same thing in
reverse. Worked great.
I use RAID1 to provide immediate backup of data, and then overnight run
cron jobs which backup specific areas (and archive stuff to a sliding
You can use the technique below (cp -alf) to keep daily snapshots and
merge into a weekly one. I also do the same to merge weekly into
monthly (in a weekly cron job) and monthly into long term archives (in
a monthly cron job)
logger -t "Backup:" "Daily backup started"
if [ -d $ARCH/daily.6 ] ; then
if [ ! -d $ARCH/weekly.1 ] ; then mkdir -p $ARCH/weekly.1 ; fi
# Now merge in stuff here with what might already be there using hard
cp -alf $ARCH/daily.6/* $ARCH/weekly.1
# Finally loose the rest
rm -rf $ARCH/daily.6 ;
# Shift along snapshots
if [ -d $ARCH/daily.5 ] ; then mv $ARCH/daily.5 $ARCH/daily.6 ; fi
if [ -d $ARCH/daily.4 ] ; then mv $ARCH/daily.4 $ARCH/daily.5 ; fi
if [ -d $ARCH/daily.3 ] ; then mv $ARCH/daily.3 $ARCH/daily.4 ; fi
if [ -d $ARCH/daily.2 ] ; then mv $ARCH/daily.2 $ARCH/daily.3 ; fi
if [ -d $ARCH/daily.1 ] ; then mv $ARCH/daily.1 $ARCH/daily.2 ; fi
if [ -d $ARCH/snap ] ; then mv $ARCH/snap $ARCH/daily.1 ; fi
# Collect new snapshot archive stuff doing daily backup on the way
mkdir -p $ARCH/snap
I backup this machine to another creating archives of the data using a
rsync - like this
rsync -aHxq --delete --backup --backup-dir=/archive/mydocs/ /home/alan/mydocs/
(Note this creates the archive on the other machine (within the module
references as "alan" by the rsyncd.conf on that other machine - despite
appearing to be added to root )
AND then I recover the archive (but you could just backup there) into
the snap directory with rsync with commands like the following
logger -t "Backup:" "Recover archive stuff"
rm -rf /bak/empty
#if we have an error at this stage it is better to exit rather than risk
loosing some archive
rsync -aHq roo::alan/archive/ $ARCH/snap/
rsync -axq --delete /bak/empty/ roo::alan/archive/