6.3.1.9. Backing up to DVD

To back up data to DVD, use the growisofs command:

# growisofs -Z /dev/dvd -RJ -graft-points /etc=/etc /home=/home /system- *

This will back up the /etc and /home directories to /dev/dvd (the default DVD recorder). -Z indicates that this is the first session on the disc, and -RJ enables long filename handling compatible with Unix/Linux (Rock Ridge) and Windows (Joliet) systems. The graft-points option permits the backed-up directories to be stored in specific directories on the disc. /etc=/etc and /home=/home specify the directories to be backed up, ensuring that each directory is placed in a directory with the same name on the disc. The argument /system-* places the system label file in the root directory of the DVD.

This command will work with DVD-R, DVD+R, DVD-RW, and DVD+RW media.

To create a compressed DVD, use the mkzftree command to create a compressed copy of the origin directories:

# mkdir /tmp/zftree

# mkzftree /home /tmp/zftree/home

# mkzftree /etc /tmp/zftree/etc

You will need sufficient disk space to hold the compressed image before it is written to the optical disc. 

Then use the -z option to growisofs :

# growisofs -Z /dev/dvd -RJz /tmp/zftree /system-*

Putting this all together into a script, and mailing the results to the email alias backup- alert , we get this:

#!/bin/bash

#

# backup-dvd :: backup selected directories to a compressed DVD

#

# List of the directories to be backed up

DIRLIST

= '

/etc /home '

# Create timestamp file

(

rm -f /system-*

touch /system-$(hostname)

# Make directory for compressed backup tree

rm -rf /tmp/zftree 2>/dev/null

mkdir /tmp/zftree

RESULT=0

for DIR in $DIRLIST

do

 mkzftree $DIR /tmp/zftree${DIR}

 RESULT=$(( $? + $RESULT ))

done

if [ '$RESULT' -eq 0 ]

then

 # Burn the DVD

 growisofs -Z /dev/dvd -RJz /tmp/zftree /system-*

 # Eject the disc

 eject

else

 echo 'Skipping burn: file compression failed.'

fi

# Delete the zftree

rm -rf /tmp/zftree 2>/dev/null

) 2>&1|mail -s 'Backup Log $(hostname)' backup-alert

Edit the DIRLIST line so that it contains a list of the directories to be backed up, separated by spaces.

Save this file as /usr/local/bin/backup-dvd and then make it executable:

# chmod u+rx /usr/local/bin/backup-dvd

And be sure to create an email alias for the backup-alert user in the file /etc/aliases :

backup-alert: chris frank

To produce a backup, execute this script:

# backup-dvd  

But it's a better idea to configure the system to run this script automatically every night (see Lab 6.4, 'Scheduling Tasks ').

6.3.1.10. Backing up to tape

To back up directories to tape, use the tape archiver (

Вы читаете Fedora Linux
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату