I had cause to need to mount a hard drive – actually, a Compact Flash card, but that’s beside the point – from an Amiga on my PC the other day. In theory, not a problem: Linux includes in-built support for Amiga FastFileSystem (AFFS) devices, so it should just be a case of identifying which of the three partitions I’m after and giving the mount command.

So, let’s fire up fdisk:

$ sudo fdisk -l
 Disk /dev/sdc: 4009 MB, 4009549824 bytes
 124 heads, 62 sectors/track, 1018 cylinders, total 7831152 sectors
 Units = sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x00000000
Disk /dev/sdc doesn't contain a valid partition table

Huh. That’s odd – it certainly should. Other partitioning tools say the same thing – and the reason becomes clear: apparently, while Linux technically understands AFFS partitions, it doesn’t actually understand Amiga partition tables. At least, most packages don’t: thankfully, one package does. So, to the wonderful parted:

$ parted /dev/sdc
 WARNING: You are not superuser. Watch out for permissions.
 GNU Parted 2.3
 Using /dev/sdc
 Welcome to GNU Parted! Type 'help' to view a list of commands.
 (parted) u
 Unit? [compact]? b
 (parted) p
 Pralloc = 0, Reserved = 2, blocksize = 1, root block at 62832
 Pralloc = 0, Reserved = 2, blocksize = 1, root block at 2112896
 Pralloc = 0, Reserved = 2, blocksize = 1, root block at 5965912
 Model: Generic STORAGE DEVICE (scsi)
 Disk /dev/sdc: 4009549824B
 Sector size (logical/physical): 512B/512B
 Partition Table: amiga
Number Start End Size File system Name Flags
 1 278528B 64061439B 63782912B affs1 DH0 boot
 2 64061440B 2099544063B 2035482624B affs1 DH1
 3 2099544064B 4009549823B 1910005760B affs1 DH2
(parted) quit

You may notice I told parted to switch unit type from the default – Compact – to Bytes. There’s a reason for that: because the kernel can’t see the partition table, it hasn’t created the usual sdc1, sdc2 and sdc3 devices under /dev – meaning I can’t tell mount where to look for the third partition, which is the one I’m after. A problem – but one that can be resolved by giving mount an offset option, taken from the ‘Start’ column of parted’s output:

$ sudo mkdir /media/AmigaMount
$ sudo mount -t affs -o offset=2099544064 /dev/sdc /media/AmigaMount
 mount: wrong fs type, bad option, bad superblock on /dev/sdc,
 missing codepage or helper program, or other error
 In some cases useful info is found in syslog - try
 dmesg | tail or so

Huh? What does dmesg have to say about this?

$ dmesg | tail -1
 [83740.730900] AFFS: No valid root block on device /dev/sdc

Okay, so that didn’t work. Now it’s time for the brute-force option: if mount’s offset command won’t work, let’s try setting up a loop device on the partition’s offset:

$ sudo losetup -o 2099544064 /dev/loop1 /dev/sdc
$ sudo mount -t affs /dev/loop1 /media/AmigaMount
$ ls /media/AmigaMount
 A500_A600_EtoZGames Disk.info Favorite Games.info
 A500_A600_EtoZGames.info Favorite Games

Bingo! At this point, you can read or write any file you like to the partition. To mount a different partition on the disk, simply give losetup the offset of that partition as reported by parted – remembering to tell parted to switch to bytes as its unit.

Having finished sticking my files on the drive, it’s time to tidy up and unmount:

$ sync
$ sudo umount /media/AmigaMount

Eject the drive, stick it back in the Amiga and lo: my files are there.

An alternative method to the above is to use an Amiga emulator on your PC: UAE, for example, can mount a real Amiga drive. This way’s easier, though – at least, if you don’t have to go through the troubleshooting steps that brought me to my understanding of the flaw.

To recap: insert Amiga drive, use parted in bytes mode to get partition offset, setup loop device at that offset, mount loop device. Not as simple as it should be, but hey: it works. This also works, interestingly enough, on disk images: create a backup of your Amiga drive with dd and you can then mount partitions directly from the backup rather than the real drive.

6 Thoughts on “Mounting Amiga FFS Hard Drives Under Linux

  1. Nice guide!
    Thanks, liviux76

  2. Dirk Heinrichs on Friday, May 31, 2013 at 15:32 said:

    Hmm, looks like your kernel doesn’t have support for Amiga partition tables compiled in. Otherwise you could simply “mount -t affs /dev/sdc2 /somewhere”.

  3. Pingback: Mounting .hdf files from Linux side? How? - English Amiga Board

  4. Thank you! Very useful tutorial, helped me to accomplish a solution to the same problem myself.

  5. Hello, thanks for your description.
    I try to read a very old drive. It may be broken, I don’t know.
    I followed your way, until parted told me

    Error: /dev/sdc: unrecognised disk label

    Last time the hdd runs was in an Amiga 500, about 15 years ago.
    do you have an idea?

    dmesg says:
    [22513.558715] scsi9 : usb-storage 2-3.2:1.0
    [22514.557116] scsi 9:0:0:0: >Direct-Access TOSHIBA MK2124FC 4 G PQ: 0 ANSI: 2 CCS
    [22514.557887] sd 9:0:0:0: >Attached scsi generic sg3 type 0
    [22514.561391] sd 9:0:0:0: >[sdc] Very big device. Trying to use READ CAPACITY(16).
    [22514.562457] sd 9:0:0:0: >[sdc] Using 0xffffffff as device size
    [22514.562463] sd 9:0:0:0: >[sdc] 4294967296 512-byte logical blocks: (2.19 TB/2.00 TiB)
    [22514.563223] sd 9:0:0:0: >[sdc] Write Protect is off
    [22514.563227] sd 9:0:0:0: >[sdc] Mode Sense: 00 38 00 00
    [22514.563970] sd 9:0:0:0: >[sdc] Asking for cache data failed
    [22514.563973] sd 9:0:0:0: >[sdc] Assuming drive cache: write through
    [22514.564850] sd 9:0:0:0: >[sdc] Very big device. Trying to use READ CAPACITY(16).
    [22514.565720] sd 9:0:0:0: >[sdc] Using 0xffffffff as device size
    [22514.567219] sd 9:0:0:0: >[sdc] Asking for cache data failed
    [22514.567222] sd 9:0:0:0: >[sdc] Assuming drive cache: write through
    [22514.609753] sdc: unknown partition table
    [22514.610791] sd 9:0:0:0: >[sdc] Very big device. Trying to use READ CAPACITY(16).
    [22514.611597] sd 9:0:0:0: >[sdc] Using 0xffffffff as device size
    [22514.616843] sd 9:0:0:0: >[sdc] Asking for cache data failed
    [22514.616846] sd 9:0:0:0: >[sdc] Assuming drive cache: write through
    [22514.616848] sd 9:0:0:0: >[sdc] Attached SCSI disk

    I’m using Linux Mint 14 (ubuntu flavored) and afaik the kernel has affs support.
    I fear the filesystem is gone -.-

    Any other suggestions are welcome.

    yours truly
    yt

  6. Dirk Heinrichs on Friday, January 31, 2014 at 17:36 said:

    You also need Amiga Partition Support in your kernel. Debian has this, don’t know about Ubuntu/Mint, though.

Leave a Reply

Post Navigation