devcopy home page

devcopy ("device copy") is a bash shell script which I wrote as a front end to rsync
I have used it under Red Hat Linux 9.0 and earlier.
I use devcopy to backup hard drives containing multiple partitions to other, similarly partitioned, drives.
You can configure devcopy for each device you want to backup, with separate "<device>.config" and "<device>.exclude" files to specify source/destination, excluded files, and other options.

Download the latest version:devcopy_1.1.tar.gz
View the source:devcopy/
View a sample config file:devcopy/hda.config

    devcopy 1.1

### URL: latest version available from:

   Greg Keraunen <>

   Backup multiple partitions on one hard drive to
   another, using rsync
   Easily configure each backup strategy with separate
   *.config, *.exclude files

### USAGE:
    cd <directory of>
    ./ <device name of drive to backup>

   The default behavior is to DELETE any files on the
   destination drive which do not appear on the source
   To change this, edit RSYNC_FLAGS, globally in, or in the .config files for each drive to

   For each drive you backup, edit the config file
   ("<drive>.config": "hda.config", etc.) to meet your
   To restrict backup to the correct destination drive,
   To get the model name string for use in the .config
   file, install the desired destination drive then do:
       cat /proc/ide/<drive>/model

   To exclude/include patterns from backup, edit
   corresponding "<drive>.exclude" files

   This script is very handy if you have removable drive
   bays for swapping in backup drives.
   I recommend having at least two removable bays: in hda
   (master IDE1) and hdc (master IDE2) locations.
   I am using the ViPower IDE removable drives in hda and
   hdc, with CD-ROM at hdb; hdd is not removable.

   After backing up, remove the backup drive and put it
   in a safe somewhere;
   install a dummy IDE drive in the removable slot, to
   maintain required master/slave bus configuration.

   I boot linux on hda and Windows on hdd (in lilo.conf,
   use: map-drive=0x80 to=0x82).
   I backup both hda and hdd to hdc location.
   Crash recovery usually requires the boot drive be in
   hda location (Windows and RedHat 7.1).

   ### To recover Windows: if Windows boot drive, hdd,
   # fails to boot
        from linux, backup hdd to hdc using: devcopy hdd;
        move the Windows backup drive into hda, load
        Windows CD-ROM
        boot from floppy with CD-ROM support and run
        SETUP.EXE from the CD-ROM
        SETUP.EXE will overwrite the MBR of the first IDE
        drive, no matter what your lilo.conf did with "map-drive"
        bios option!
        shutdown and move the recovered drive from hda
        back into hdc, replace the linux drive in hda; reboot
        into linux
        copy hdc to primary Windows boot drive, hdd with:
        devcopy hdc

        NOTE: make sure that Windows SETUP.EXE can
        actually install to your backup (removable) drive!
                In my case, WindowsMe SCANDISK was run
                and complained: "...cannot work with 64K FAT
                I tried FDISK, FORMAT - nothing could
                make SETUP.EXE work on this drive
                The drive works fine once the files are
                copied onto it, from linux!

   ### To recover Linux (RH 7.1):
        If backup drive is bootable, run lilo to update
        MBR to reflect latest lilo.conf
        If drive doesn't boot:
           with drive to be rescued in hda location; boot
           from RH 7.1 disk1 CD-ROM
           choose 'linux rescue' boot image
           cd /mnt/sysimage; chroot .; lilo
           remove CD-ROM; reboot

            I have not figured out how to successfully
            copy MBR from linux source to backup drive
            This should work but this hasn't worked for
                dd bs=512 count=1 if=/dev/hda of=/dev/hdc
                (I think boot sector is first 446 bytes;
                partition map is 447 to 512)
            This should also work:
               lilo -b /dev/hdc
            In both cases, the drive, when inserted into
            hda location merely displays "LI" before hanging
            Therefore, booting linux from the backup
            drive is not possible until you first run lilo with the
            backup drive in hda location

 ### rsync operation: See rsync man page for details like
 # these:
       If the pattern starts with "+ " (a plus followed
       by a  space) then  it  is  always  considered  an
       include pattern, even if specified as part of an
       exclude option. The "+ " part is discarded before

       A trailing / on a source name means "copy the
       contents of this directory".
       Without a  trailing slash it means "copy the

 ### TODO:
   1) rsync is more flexible than the contraints of this
       I could implement greater configurability such as
       rsync --include
       Could, accept a list of directories for
       source/destination rather than always backing up entire
   2) Instead of configuring by device name, I could use
   arbitrary target names to allow better control of rsync
       config files would then become: "<target
       name>.config"; DEVICE_NAME would be a configurable