Wednesday, July 25, 2018

Inspecting an Atari ST hard disk image with Unix / Linux tools

GNU libparted has Atari partition table support since two years ago. For this you will need the disktype and parted programs. Any good Unix should have those (I use Debian GNU/Linux)

Let us try this with a disk image I used for my Ultrasatan device, for example st_mint
wget http://www.subsole.org/static/retrocomputing/st_mint-0.7.img.zip
Unzip the disk image
unzip st_mint-0.7.img.zip
 Inspect the diskimage with the disktype program, an excellent disk analysis tool.
disktype st_mint-0.7.img

--- st_mint-0.7.img
Regular file, size 600 MiB (629145600 bytes)
ATARI ST partition map
Partition 1: 128.0 MiB (134201344 bytes, 262112 sectors from 4, bootable)
  Type "BGM" (Big GEMDOS)
  FAT16 file system (hints score 3 of 5, ATARI ST bootable)
    Unusual sector size 4096 bytes
    Volume size 127.9 MiB (134119424 bytes, 16372 clusters of 8 KiB)
Partition 2: 384.0 MiB (402666496 bytes, 786458 sectors from 262116)
  Type "MIX" (Unknown)


Notice the two partitions, first one is of type BGM, the second one is a Minix partition.

Print the partition table parted (this will output some warnings if running as non-root)
parted st_mint-0.7.img print
Partition Table: atari
Disk Flags: 

Number  Start  End    Size   Type     File system  Flags
 1      2048B  134MB  134MB  primary               boot
 2      134MB  537MB  403MB  primary

 Print the partition table with the begin and end of each partition being printed in bytes we will need this to create the loopback devices
parted  st_mint-0.7.img -- unit b print
Partition Table: atari
Disk Flags: 

Number  Start       End         Size        Type     File system  Flags
 1      2048B       134203391B  134201344B  primary               boot
 2      134203392B  536869887B  402666496B  primary

 Now using the beginning and end of each partition in bytes from the line above, create the /dev/loop devices corresponding to each partition:
sudo losetup --find --offset 2048 --sizelimit 134201344 --verbose st_mint-0.7.img

This should give a loopback device
losetup --all
/dev/loop3: []: (/home/manu/Téléchargements/st_mint-0.7.img), offset 2048, sizelimit 134201344
Now let us do a file check on the partition
sudo fsck.vfat /dev/loop3 
fsck.fat 4.1 (2017-01-24)
/dev/loop3: 217 files, 966/16372 clusters
and mount it
sudo mount /dev/loop3 /mnt

looks an Atari ST system inside
ls /mnt
APPS  CBHD502   CLIPBRD  FSELECT.INF  MICO  MULTITOS     TOOLS
AUTO  CBHD.SYS  CRIPPLE  HUSHI.SYS    MINT  NEWDESK.INF 
 
file /mnt/APPS/QED/QED.APP 
/mnt/APPS/QED/QED.APP: Atari ST M68K contiguous executable (txt=189972, dat=16234, bss=103214, sym=0)

when your work is finished, unmount the partition and detach the loop device from the disk image
sudo umount /mnt
sudo losetup --detach /dev/loop3 

1 comment:

Moebius said...

Bonjour,
I don't know if you are french like me so I go on with (bad) english
I'm looking for recovering the content of my falcon hard drive.
I've made an image of it :
$dd if=/dev/sdg of=./sdg.img
after that :
$disktype sdg.img

--- sdg.img
Regular file, size 3.330 GiB (3575496704 bytes)
ATARI ST partition map
Partition 1: 500.0 MiB (524286976 bytes, 1023998 sectors from 2, bootable)
Type "BGM" (Big GEMDOS)
Partition 2: 900.0 MiB (943716864 bytes, 1843197 sectors from 1024000)
Type "BGM" (Big GEMDOS)
Partition 3: 950.0 MiB (996144640 bytes, 1945595 sectors from 2867197)
Type "BGM" (Big GEMDOS)
Partition 4: 1.945 GiB (2087919104 bytes, 4077967 sectors from 4812792)
Type "XGM" (Extended)
Partition 5: 991.2 MiB (1039345152 bytes, 2029971 sectors from 1)
Type "BGM" (Big GEMDOS)
Partition 6: 0.977 GiB (1048572928 bytes, 2047994 sectors from 1)
Type "BGM" (Big GEMDOS)

ok everything sound good but :
$sudo parted sdg.img print
Error: /disque3/espace5/atari/sdg.img: unrecognised disk label
Model: (file)
Disk /disque3/espace5/atari/sdg.img: 3575MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

So, as /dev/sdg1 to /dev/sdg5 exist, for every partition I've done, for x = 1 to 5 :if=/dev/sdgx of=./sdgx.img
Then no need for parted, just dmake a loopback device and control if created :
$sudo losetup --all
/dev/loop0: [2097]:5505026 (/disque3/espace5/atari/sdg1.img)
Control the loopback device :
$ sudo fsck.vfat /dev/loop0
fsck.fat 4.1 (2017-01-24)
/dev/loop0: 1564 files, 17997/31990 clusters
Sound very good but :
$ sudo mount /dev/loop0 /media/moebius/atari/
mount: /media/moebius/atari: mauvais type de système de fichiers, option erronée, superbloc erroné sur /dev/loop0, page de code ou programme auxiliaire manquant, ou autre erreur.

Error not really defined
Any idea ?

cordialement,