Hard Disk Backup Question

Nataraj incoming-fedora-list at rjl.com
Sun Nov 18 03:19:36 UTC 2007


On Fri, 2007-11-16 at 08:06 -0500, Ralph De Witt wrote:
> Hi All:
> I have a Dell Inspiron E1705 Computer with a 80 gig hard drive. I also have a 
> Western Digital 500 gig My Book External USB Hard Drive attached. I would 
> like to Back up the entire hard drive to a partition on the external drive. I 
> have very little knowledge of how to do this. I have always backed up to a CD 
> individual files after a data loss. I thought a auto backup routine would 
> work, but the computer may not be on when the backup would be scheduled, and 
> the external hard drive partition do not seem to want to auto mount so that 
> would not work. I am using the kde desk top. Could some one add to my 
> knowledge and help me out? TIA
> -- 
> 	Yours,
> 	Ralph.
> It said Use Windows XP or better, so I installed Fedora 8
> Register Linux User 168814 ICQ #49993234 AIM & Yahoo ralphfdewitt jabber.org 
> ralphdewitt
> GPG Public Key available at http://www.keyserver.net
> Key id = 3097 3BC4
> Kernel version 2.6.23.1-49.fc8
> Current Linux uptime: 44 days 1 hours  minutes.
> 

Hi,

Here's a few more ways:

rsync -avu /path/to/directory /path/to/backup/directory

Optionally the destination can be on a different system (define the
environment variable RSYNC_RSH as /usr/bin/ssh)
   rsync -avu /path/to/directory hostname:/path/to/backup/directory

Rsync will, will only copy files which have changed. If run with the -n
option, i.e.: rsync -navu /path/to/directory /path/to/backup/directory
It will show which files would be updated without actually updating
them.  It is very fast if there is not alot of data that has changed.

Another option is the dump/restore utility, which can be used to create
a compressed dump to a disk file.  Optionally an index file can be
created to allow restore to seek directly to individual files stored
within the dump.  So you could restore an entire filesystem, or just 1
or more files from the dump.  Here's a simple shell script which creates
a backup with a dump file, an index and a log of the dumping operation.

If you have a slow system, you may want to check the man page and change
the -j option to dump to reduce compression, since high compression
levels can take a long time.


#! /bin/bash

# USAGE: dumpit LEVEL DUMPDEV DUMPID
# EXAMPLE: dumpit 0 /dev/md2 root
dumpit() {
   level=$1
   dumpdev=$2
   dumpid=$3
   DATE=`date +'%m-%d-%y'`
   DEVNAME=`basename ${dumpdev}`
   fname="${dumpid}_l${level}_${DATE}_${DEVNAME}"
   index_suffix=qindex
   dump_suffix=dump
   log_suffix=log
   index_file="${fname}.${index_suffix}"
   dump_file="${fname}.${dump_suffix}"
   log_file="${fname}.${log_suffix}"
   if [ -f ${index_file} ]; then
      echo "***ABORTING:  ${index_file} already exists"
      exit
   fi
   if [ -f ${dump_file} ]; then
      echo "***ABORTING:  ${dump_file} already exists"
      exit
   fi
   if [ -f ${log_file} ]; then
      echo "***ABORTING:  ${log_file} already exists"
      exit
   fi
   echo "***RUNNING: /sbin/dump -${level}ua -Q ${index_file} -f ${dump_file} -j2 ${dumpdev} > ${log_file} 2>&1"
   /sbin/dump -${level}ua -Q ${index_file} -f ${dump_file} -j2 ${dumpdev} > ${log_file} 2>&1
}


# Note the above is a shell function
# To call it with a level 0 dump of /dev/md2 (use /dev/sdN for non raid
# disks) Use the following command.  root is simply an indentifier used
# in the filename.  Use Level 0 unless you want incremental dumps.

#**** THE DUMP FILES ARE CREATED IN THE DIRECTORY THAT 
#**** YOU ARE CURRENTLY cd'ed to.

dumpit 0 /dev/md2 root

TO do an interactive restore from the backup, where you can list files
and add them to a restore list, use:
restore iv -Q backupfilename.qindex -f backupfilename.dump

Once you get the restore prompt you can use "ls" and "cd" to move around
the files in the backup.  Use "add" to add individual files or directory
trees to the extraction list, then "extract" to restore the
files/directories into the currently cd'd tree.

The following command will restore the entire dump to the currently cd'd
directory.

restore rf backupfilename.dump


Nataraj












More information about the fedora-list mailing list