*** DISCLAIMER: The information on these pages is not an official instruction or documentation. No responsibility will be taken. Use at your own risk. ***

Sunday, March 5, 2023

How to prepare a CompactFlash card for Amiga PCMCIA using Linux

An example how to prepare a CompactFlash card for Amiga compactflash.device (cfd) / FAT95 using Linux Fedora Core 33.

The idea is to wipe the CompactFlash card, and create one big partition for Amiga PCMCIA slot use. The procedure should basically be the same on all Linux distributions. Make sure your "mkfs" command has "vfat" support (which it probably has).

0. unplug CompactFlash card device

This makes it easy to identify the card, by plugging it in and watching what happens (see next step).

1. open a shell, log in as root, and watch your system's messages

On Linux Fedora, the system writes messages to /var/log/messages. "tail -f" displays the file's last lines (tail), and updates the output as the file changes ("-f" = "follow").

Watch system messages

2. plug in and identify CompactFlash card device

Plug in your CompactFlash card / reader. The reader used in this example has four slots, with a 1GB CompactFlash card inserted into one of them. As we can see it shows up in the log as drive "sdc".

Find drive name

3. run "fdisk", review and remove existing partitions

This CompactFlash card already has a couple of partitions - we just remove all and start from scratch. In this example, the shell command is "fdisk /dev/sdc" - replace "sdc" with your card(reader)'s drive name from previous step. fdisk's command to print the partition table is "p", and to delete a partition it's "d".

Remove existing partitions (if required/desired)

4. add new partition, set size and file system type

We want to create one big partition for Amiga use. fdisk provides default values for a full size partition, but we leave a little space at the end, in case some emergency-space is required one day. fdisk's command to create a new partition is "a" ("add"). See fdisk's output for size specification.

Add new partition

The new partition has been created with file system type ID 83 / Linux - we have to change that to Windows FAT95.

fdisk's command to set partition type is "t". It automatically selects our only partition (otherwise it would ask for partition number), then asks for new partition type (or "L" to list all types): 

Change partition type

For Amiga's FAT95 filesystem we need partition type "W95 FAT32", which has the Id "b" (or "0b"), as shown by the list of types:

Type Id "b" is for "W95 FAT32"

5. save changes (and reboot)

We're almost done. Enter "p" to print the partition table. It should now show Id "b" and Type "W95 FAT32".

Enter "w" ("write") to save changes.

Review changes, and save

In this example, previously existing partitions on the CompactFlash card were still mounted - see red error messages - so we reboot system with "shutdown -r now".

If your system didn't mount any partitions from your card, then no reboot is required.

Watch your system's messages, re-plug your CompactFlash card (reader), and note its drive name (as in steps 1 and 2) - it probably hasn't changed, just to make sure.

Re-plug and re-check drive name before formatting

6. format new partition as FAT filesystem

Just to make sure we review our partition table before formatting. Run fdisk with your drive's name (example: fdisk /dev/sdc), then enter "p" to print partition table. Note the number of your partition - probably 1. (example: /dev/sdc1, which is number 1.)

Make sure it's the right drive name and partition number

Here's a little optional step that you can safely skip: Activate the partition for booting. The Amiga (compactflash.device / FAT95 / PCMCIA slot) doesn't care, but it might come in handy some day if this CompactFlash card is put into some other machine. fdisk's command to make a partition bootable is "a" ("activate"). Enter "w" to save changes when done. (The new partition wasn't mounted, so changes take effect immediately, no reboot required.)

Optional: make partition bootable (ignored by the Amiga)

Finally, format the new partition with "mkfs" as filesystem type "vfat". Depending on your Linux distro, your mkfs command might look different. On Linux Fedora Core 33 "mkfs.vfat" is available to create a FAT filesystem. On other systems you may have to give command line options (e.g. "mkfs -t vfat ...").

In this example, the full command is: mkfs.vfat /dev/sdc1

Format new partition as type "vfat"

We're done!

To test our newly prepared CompactFlash card, we unplug, and re-insert it. Now the system should auto-mount the new partition.

New partition auto-mounts

This is what it looks like in PCManFM filemanager:

Empty partition in PCManFM filemanager

And here's the information given by "mount", "ls" and "df"

Command line information about the partition

Amiga PCMCIA slot

This is how the CompactFlash card (CF0:) looks from the Amiga side when put into the PCMCIA slot (via adapter) with compactflash.device and FAT95 installed:

Amiga "info" command output

Compactflash.device:
http://aminet.net/package/driver/media/CFD133

FAT95 filesystem:
http://aminet.net/package/disk/misc/fat95

(Note: Check for latest versions)



No comments:

Post a Comment

Your comment will published after it has been reviewed.