Monday, 16 May 2016

Amiga Compact Flash HD corruption

This post talks about an emulated Amiga, with CF cards as hard drive, under Linux Mint. Things work a little bit differently under Linux. This post might help you, or me in the future when I need to re-do steps :)


I use a compact flash (CF) card as hard disk in my Amiga 4000D.  When booting the machine the following error message was displayed: Not a DOS disk in DH0.  When the machine was turned off some time ago it was working just fine, so there must be something off.

Taking the CF card to my PC, which uses Linux, I had the challenge to mount the CF card so I could play with the disk in FS-UAE. Mounting a CF card happens automatically in Windows but not on Linux. So, some work to do!

Turns out that most Linux kernels recognize the Amiga FFS (Fast File System) but not the partition table. So how to inspect the condition of the partitions? I came across this lovely post, tacking the same challenge. Following the procedure mentioned there, using parted, I got the following output:

Disk /dev/sde: 3997MB
Sector size (logical/physical): 512B/512B
Partition Table: amiga

Number  Start   End     Size    File system  Name  Flags
 1      8259kB  277MB   268MB                DH0   boot
 2      277MB   801MB   524MB   affs1        DH1
 3      801MB   3997MB  3196MB               DH2

Oh dear! My boot partition does not show the file system anymore. The partition holding WHDload and games is also not reporting the file system. Can this be fixed? I doubt it, but it sure is apparent that I also need a proper backup methodology for my Amiga CF card, because reinstalling every time a problem occurs is not something I am looking forward to.

Trying to mount /dev/sde or /dev/sde1 (the 1st partition) results in the error message using dmesg to view the driver messages: [3597.260224] affs: No valid root block on device sde

As expected! :( Mounting sde2 works though: sudo mount -t affs /dev/sde2/ /mnt/cflashcard/

Also as expected! Running nemo (the Linux Mint file manager) as ROOT enables me to copy the stuff from there to my PC:


Having saved the available data, it's time to reinstall. First we are going to remove all partitions from the CF card.

After un-mounting the partition, we remove the partitions from the CF card by starting parted and using rm <partitionnumber> for each partition. Make sure to target the right device :)

So let's go to FS-UAE-LAUNCHER.

Configure the Amiga 4000 emulated machine

NOTE: Start the launcher with root permissions or you will not be able to use the CF card device file.

I have created a new configuration, and selected the A4000/040 as the configuration.

We want to connect the CF card as the hard drive to the Amiga. As everything on Linux is a file, we need to select the file under which our CF card is presented to the system: /dev/sde. Again, this is a file, so press the disk tab in the launcher and select the "Browse for file" icon to the right of the first drive. Browse to /dev and even though you do not see the sde file, type in its name, like so:

Click Open and the device will show up as follows:

Now go to the floppy drive tab and select the Workbench Install disk (and the other disks) to begin installation.

After boot, copy the HDToolbox program to your RAM disk, and change its icon property SCSI_DEVICE_NAME to uaehf.device. You should now be able to see the CF card and partition it and then format it with FFS. Make sure to enter the Advanced Settings and set the max transfer to 0x1fe00. There was no need for me to disable International Mode as required on Windows.

Check out this post I've made earlier for more details.

Review 1541 Ultimate II+

Recently I bought the new version of the 1541 Ultimate II cartridge. It is the best investment you can do when you enjoy your Commodore 64 a...