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.

16 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.

  7. Pingback: access amiga FFS Hard Drive (or CF) under ubuntu – the wet machine

  8. I’m trying to mount my Amiga drive, and have run into a problem that requires some advice…

    When I run parted, I get the message:

    Warning: Error fsyncing/closing /dev/sdb: Remote I/O Error.

    A check of dmesg returns this:

    end_request: critical target error, dev sdb, sector 0

    Maybe a hardware failure…? Because it worked when I tried mounting a different drive…

  9. Dirk Heinrichs on Sunday, April 2, 2017 at 20:56 said:

    I’m a bit confused, because of “trying to mount” vs. “When I run parted”. So do you actually want to mount it or partition it?

    Anyway, does your kernel have support for RDB partitions and the Amiga FFS? If yes, it should simply work. If not: Did you try to access the device in a real Amiga (running AmigaOS or Linux)?

  10. Okay – sorry about the confusion…

    I run fdisk to examine the drive, and get the same “drive doesn’t contain valid partition table” that you did… so I run parted to tweak the drive the way you described. When the program starts up, I get the first error message. At that point, I’m given the option to Retry or Ignore – Retry keeps looping, and Ignore will allow me to make the adjustments… but apparently won’t write them to the drive. This prevents me from continuing the process of mounting the drive.

    Unfortunately, I don’t have access to a working Amiga computer at the moment – the last time I had one, it seemed to function properly. (Although – in retrospect, it *may* have been the cause of the Guru-Meditation crashes I kept getting…)

  11. Dirk Heinrichs on Tuesday, April 4, 2017 at 16:33 said:

    You can’t use standard fdisk, you’ll need amiga-fdisk. On Debian, this is packaged as amiga-fdisk-cross. Don’t know about parted, never tried to actually partition an Amiga drive with it, but amiga-fdisk should just work.

    OTOH, if you only need it to see which partitions the device has, just run dmesg after plugging it in.

  12. Tobias Biehl on Thursday, May 7, 2020 at 00:24 said:

    If you mount with the offset from parted, make sure you provide the size as well:

    $ sudo mount -t affs -o offset=2099544064,sizelimit=1910005760 /dev/sdc /media/AmigaMount

    Should work fine like this, I had same issue when mounting until I added the sizelimit option.

  13. Cheers – I’ll give it a go!

  14. Dirk Heinrichs on Thursday, May 7, 2020 at 19:08 said:

    I still wonder why you’re all so keen on these offsets. Debian kernels of today still include support for Amiga RDB partitions as well as AFFS:

    % uname -a
    Linux moria 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1+deb10u1 (2020-04-27) x86_64 GNU/Linux
    % grep -E “AFFS|AMIGA” /boot/config-4.19.0-8-amd64
    CONFIG_AMIGA_PARTITION=y
    CONFIG_AFFS_FS=m

    So all you need to do is

    mount -t affs /dev/sdcX /mnt

    where X is the partition number. You can even view (and maybe work on) the partitions by installing amiga-fdisk-cross on your Debian Linux PC.

  15. Randall Crook on Friday, April 30, 2021 at 05:52 said:

    Can you do the same thing on a disk image? IE: Loopback mount a image mounted by loopback?

  16. If you are using a SCSI2SD device, which stores up to 4 virtual SCSI drives on a SD card, you’ll need to use offsets and loops to access drives 2-4 as your card will have up to 4 different partition tables spread across it.

    Linux will only see a partition table on the first virtual drive and will think the rest of the card is unallocated space.

    If you only need to access the first drive, you can simply use “mount -t affs /dev/sdcX /mnt”, but the other drives will need offsets and loops.

    You can get the offset values for the virtual drives from the SCSI2SD setup program (sector start * 512).

    When running losetup, use the -P option to force it to read the partition table on the looped drive. You can then mount the partitions using /dev/loopXXp1, /dev/loopXXp2, etc.

Leave a Reply

Post navigation