CP/M Filesystem in userspace

cpmfuse is the combination of the FUSE project by Miklos Szeredi (delivered with most modern Linux distros), and the cpmtools project by Michael Haardt. An equivalent for Windows exists, called cpmcbfs.

It was written because some users of my Memotech related projects prefer not to use command line tools. Memotech computers used CP/M 2.2 filesystems, even when accessing floppy disks from BASIC. I include appropriate diskdefs for these.


$ cpmfuse --help
usage: cpmfuse mountpoint [flags]
flags: -f,--format format  f/s format (default $CPMTOOLSFMT or memotech-type18)
       -i,--image image    f/s image (must be specified)
       -u,--user user      CP/M user (default 0)
       -v,--invert-case    toggle case to match what CP/M uses
       -h,--help           print help
       -V,--version        print version
       ...                 other fuse related options
$ mkdir mnt
$ cpmfuse mnt -f memotech-type18 -i /dev/sde -v
$ ls mnt/S*.COM
$ ls -l mnt/*.DOC
-rw-rw-rw- 1 root root 3072 Jan  1  1970 mnt/VDEB.DOC
$ fusermount -u mnt
$ ls mnt

Because cpmfuse is built using code from cpmtools it uses the same diskdefs and /usr/share/cpmtools/diskdefs configuration file, and also uses the same filesystem format names.

If -f is not used cpmfuse honors the $CPMTOOLSFMT environment variable, and failing that falls back to memotech-type18.

Note how the -i argument must be specified, and can refer to a device, such as an SD Card.

CP/M filesystems support the concept of 16 (or maybe even 32) users. You can specify the user when you mount.

Although CP/M actually uses uppercase filenames, cpmtools makes it look as if they are lowercase. Ordinarily this is not a problem, except for the case where CP/M programs actually break the rules and write files with lowercase names. The -v problem toggles the case so that the files appear in uppercase on Linux.


cpmfuse doesn't expose any special files such as passwords or labels. Raw cpmtools does, as specially named files.

Read only status is affected by the 0200 weighted file permission. Other file attributes are not supported. cpmfuse doesn't fabricate the execute bits if the filename ends in .com as Linux won't be able to execute these files anyway.

cpmtools seems to have a bug in cpmfs.c line 812, causing it to apply exact file length logic to all versions of CP/M, not just the ISX variant, as it should.

If you create a file and then don't write anything to it, you seem to end up with a file containing 128 bytes of 0. I think this may be a consequence of cpmCreat locating a file extent, prior to any cpmWrite that might follow.

Attempts to create subdirectories will fail.

Attempts to create files with certain characters in their names (those not allowed by CP/M) will fail.

Attempts to change file ownership will fail.

Attempts to set creation, modification and access times may work on CP/M filesystem versions that support it, but silently do nothing otherwise.

In the filesystem statistics (as returned by df) where it returns the numbers of files free (free inodes), this is actually the number of free directory entries. Note that large files consume more than one directory entry.

I didn't keep all the configure stuff in the original cpmtools source code. You can easily tweak the makefile and config.h if needs be.


It is interesting to note that Michael Haardt wrote a folding editor (called fe) and the cpmtools source code is folded. I too wrote a folding editor (called ae) and the cpmfuse source code is also folded, although differently. Hopefully the result isn't too crumpled.


cpmfuse can be downloaded from http://www.nyangau.org/cpmfuse/cpmfuse.zip.

This page maintained by Andy Key