home   sections   references   cd:s   about   links   heptagon 
 no margins   view as black text on white background 

Transfer files from an Atari-formatted hard drive

I had this problem recently: I had an old Atari SCSI hard drive and wanted to copy all the files from it to a PC. But simply using the Atari machine itself to traverse the filesystem, and then (I guess) somehow sending the stuff over the serial interface, would have been way too slow. Also I was not sure how much life the drive had left in it, it had sat in a cold locker for many years without being powered up. So this is what to do instead...

By the way, if you're like me and you're running Windows on a daily basis, you can use Gemulator (from http://www.gemulator.com) to temporarily run any old Atari programs that are required to read or manipulate your old Atari files. But when I tried to run Gemulator on my ICD-formatted Atari hard disk image, it appears it does not recognize or read the "big" ICD partitions — that's why I had to run thru all the hoops below!

Make sure you have Linux installed

Doesn't everyone have a small Linux partition set up for this type of stuff, nowadays? At the time of writing, I use the RedHat 6.1 distribution ("Cartman", kernel 2.2.12-20).

Make an image file of the drive

Power up the drive, connect it to the SCSI interface, and boot to Linux. Depending on the SCSI address of the drive, it will be a device under something like /dev/sdax where x is the SCSI address. Make sure you have enough disk space to mirror the drive, and type

	dd if=/dev/sdaXXX of=atari.dsk
where you of course replace /dev/sdaXXX with the appropriate device (/dev/sda0, /dev/sda4 or whatever).

You should probably verify that you have a drive image that's the size of the drive. Now you can power down the drive again forever, without any more worries about head crashes, stiction, whatever.

You can of course use a different image file name than 'atari.dsk', the perl script below assumes that name though.

Get the bootsector info

This is the tricky part, and took me a little while to research. As GEMTOS is pretty much a "dead" operating system the internal structures of the format aren't that readily available on the net. And I happened to have used the ICD AdSCSI adapter and ICDBOOT, which at the time was great because it enabled larger partitions, but of course have a less "standard" disk structure.

The good news is that the actual partitions are very similar to DOS partitions. So once you have the start sector numbers you can use 'mtools' under Linux to access them transparently, even 'BGM' partitions, using the MTOOLS_SKIP_CHECK option. (It might even be possible to mount them as linux filesystems, with read-write access and whatnot, using one of the /dev/loop devices, but I didn't go that far in my experimentations. If you're curious see man losetup and man mount..)

Once I had figured all of the above out*, it was a simple procedure of writing a small perl script to extract the offsets from the root sector (sector 0). The script in question (ataripart.pl) is here (updated 2005/04 — it appears some of the flags and behavior for mtools have changed. The old perl script is here.

The script writes the correct .mtoolsrc . This overrides the "standard" settings of the mtools utilites, so any mtools commands you execute from within that directory will refer to the Atari HD image, ie, mdir c: will list the contents of the Atari boot drive. The perl script also writes a file (called 'source-me') with the correct mtools commands to transfer all the files from the various partitions to the separate directories 'atari/c', 'atari/d', etc.

Transfer the files

Once you verify that mtools is indeed reading the drive image correctly (for instance you could try
	mdir c:, mdir d:
etc for all the Atari partitions you remember having) you can go ahead and transfer the files. You can either do it manually by issuing commands such as

	mcopy -snm "c:/*" atari/c
(The option flags '-snm' mean: recurse thru all subdirs, preserve original timestamps, replace files without asking) You can also automatically do this to all the drives the perl script found, by typing

	source source-me
One caveat: the Atari operating system was not picky at all when it came to file names. Filenames containing "?" or "/" were no problem, nor "forbidden" words under DOS such as AUX or CON. So if you are copying the files to a normal FAT/FAT32 partition, you may get errors when attempting to create some of them..

Page updated Apr 8, 2005 at 23:31 Email: jens@panix.com

All content copyright © Jens Johansson 2024. No unathorized duplication, copying, mirroring, archival, or redistribution/retransmission allowed! Any offensively categorical statements passed off as facts herein should only be construed as my very opinionated opinions.