Classic Computer Magazine Archive START VOL. 3 NO. 9 / APRIL 1989

ON DISK!


Small Tools

Partcopy: An Ultra-Fast Partition Copier

by Dave Small and Dan Moore



Move a meg in four seconds with PARTCOPY.ARC on your START disk!

This month put all you've been learning from Hard Disk Lore and First Aid to use with Partcopy, a high-speed hard disk partition copier. This is an extremely powerful tool for moving big blocks of data around on your hard disk, or from one hard disk to another.

Like any powerful tool, Partcopy has the potential for misuse. We don't put limits on what you can do with it because that would limit its power. Treat it like you would treat a bandsaw--with caution. In particular, do not use it until you understand partitions and hard disks (which you do if you've been following this column, right?).

Partcopy lets you move a block of sectors of any size from any hard drive to any other hard drive, at the very high speed of one megabyte every four seconds.

Let's take a typical example of how I use Partcopy. When I'm about to start a day's development work on Spectre 128, I want to completely back up my Spectre development area, 10 megabytes long, in case I wipe it out.

I plug a second drive in (as per my article "Megabytes, not Megabucks" from the Winter 1987 issue of START) and run Partcopy. I instruct Partcopy to move the 10 megabytes that constitute my Spectre partition to the first partition of the backup drive, also 10 megabytes long. Forty seconds later, it's done. I park the backup drive, put it on the shelf, and I'm. ready for anything. (At that point, not even a power spike can take out the Spectre development).

Many, many times I've wiped out the Spectre area, either by accident or by a built-in ST feature (40 folder limit), and these backups have saved me. One night I lost 140 megabytes worth of hard disks to a power surge, and the only things left were the backups on the shelf.

You can also move one partition to another very quickly with Partcopy. Let's say I wanted to copy the C partition to the D partition. I could just drag all the files from one to the other and fall asleep watching it go (TOS takes a long time to copy all these files), or I could turn loose Partcopy and have it done in 40 seconds.


Your lucky Numbers

To run Partcopy, copy PARTCOPY.ARC and ARCX.TTP onto a blank, formatted disk and un-ARC PARTCOPY.ARC, following the Disk Instructions elsewhere in this issue. You need to feed Partcopy several numbers, all in decimal:

1. The source drive's SCSI ID and Logical Unit Number (LUN). If you don't know what you're doing, these are usually 0 and 0, but if you don't know what you're doing, for heaven's sakes don't run this program.

2. The destination drive's SCSI ID and LUN. Again, this will depend on how your system is set up. You can of course have these be the same as your source, and copy within the same drive; I do it all the time.

3. The starting sector number on the source drive where you want the copy to come from.

4. The destination sector number on the destination drive where you want the copy to begin.

5. And, finally, the number of sectors to copy.

Where do you find these numbers? If you have the January 1989 issue of START you can run our Partlook program, which will give you a partition map of your hard disk--where each and every partition begins and ends. Supra's SUPEDIT utility provides these numbers as well.


Proceed with Caution

Let's do a quick run-through, since this is best taught by example.

We have a 20 megabyte drive, consisting of four 5 megabyte partitions: C, D, E and F. We want to completely copy, say, C to F to make a morning backup.

We run Partlook and discover the disk looks like this:

    C: Sectors 1-10001
    D: Sectors 10002-20002
    E: Sectors 20003-30003
    F: Sectors 30004-40004

The hard disk is our sole hard disk, so as usual it's wired as SCSI 0, LUN 0.

We tell Partcopy to copy from SCSI 0, LUN O to SCSI 0, LUN 0, starting at sector 1, to sector 30004, length 10000 sectors. (To think of the operation in megabytes, divide the number of sectors by 2,000--2,000 sectors is 1 megabyte )

Then, before you can recite the Pledge of Allegiance, the copy will be finished--five megabytes will be copied from drive C's partition area to drive F's area. Note that this will complete wipe out whatever was stored on drive F. Don't do this unless you want to use that partition for backup only.

Warning: Know exactly what you're doing before you do this. Back up your drive first. It is easy to mistype a number, and then you're doomed. Partcopy does print back your numbers to you before doing the copy, for a final check. Common mistakes are to start at sector 0, or (in the E example) sector 20,000 instead of sector 20,003, or to copy a partition that's a little too big to fit into the destination, and have it "slop over" into the partition following.

After you do the copy, you must reboot the system. GEM has, in system memory, a copy of what the old partitions looked like, that can't be easily updated. You must reboot to get the new copy read in, or GEM will horribly trash the new partition based on its old, incorrect data. I know from experience. Partcopy will not automatically reboot for you; you must do it manually.

To use Partcopy again just type "yes" at the appropriate prompt. Control C will exit anytime if you type in something wrong. You are given a chance to escape before the copy starts.


Error Intolerance

Partcopy is not very tolerant of errors; it just stops if you get one. Why, you ask? Well, hard disk controllers are supposed to "map out" errors at format time so you never see them. (The controller replaces the bad sector with a known good one.) If you're getting hard disk hits, it's time to reformat or get a new hard disk anyway; you're riding a thin edge of disaster. Just one little hit in the directory, and poof, you're gone.) Thus we felt that giving you an imperfect copy, especially during a backup, wasn't a good idea. Depending on how far you are into the copy operation when an error occurs the destination partition may be garbled because it has half new information and half old. You may want to reformat the destination partition and then do a file-by-file backup to it to determine the bad file.

Partcopy can also be very useful when debugging a marginal disk drive. Just use Partcopy to copy a drive onto itself; that'll exercise the living heck out of the read/write circuitry, and read/write every sector on the disk. (Two tools in one! - the ultimate hard disk exerciser). This helped me debug a partially broken SCSI cable-I ran Partcopy, and started wiggling cables. When I wiggled the right place, Partcopy stopped.


Cloning an Entire Drive

To completely clone a hard disk onto another is simple with Partcopy. Plug them both in, and use Partcopy starting from sector 0 to the length of the hard disk. For instance, a common length for the whole drive on a 20 meg unit is 40,006 sectors (see table above: 40,005 sectors, plus the zeroth (partition) sector, is 40,006 sectors). So copy from your source disk, starting at sector 0 for 40,006 sectors and you've cloned the drive--and darn fast, too. Twenty megabytes will take you 80 seconds.

This is the absolutely most-used tool Dan and I have written. When you can afford multiple hard drives it's worth it to back up hard disk to hard disk just in terms of time. Also, the cost of using floppies to back up big drives gets old after awhile, and a 20 megabyte mechanism can be had for under $200. I use Partcopy all the time for backups, and many are the times it's saved me. An 80 second backup, I'll do--a 20 minute backup, I tend to put off.


Conclusion

I hope you find Partcopy as useful a tool as I have! Again, never use it if you're not absolutely sure what you're copying, and be careful with it.

Dave Small's zest for fast and easy backups is the result of hard disk crashes encountered during his low-level work developing Macintosh emulators for the ST. Dan Moore is the author of Paper Clip for the 8-bit Atari and the never-released Paper Clip Elite for the ST.


PRODUCTS MENTIONED

Hard Disk Utilities, $24.95. Supra Corp., 1133 Commercial Way, Albany OR 97321, (503) 967-9075.