BE memory extension for editing devices

Download from

What it does

BEDEV is a 'memory extension' helper module which provides Andys Binary Folding Editor with the capability to edit devices.

BE normally reads the files its editing into memory, and to do so it needs to be able to determine the size of the file, and have memory to read the whole thing in. This isn't practical for device special files.

BEDEV works by opening the device special file and keeping the file handle handy. When BE asks for data to display, it seeks to the right position and reads a byte. When BE edits data, it seeks to the right position and writes a byte back.

BEDEV does not cache any data from the file, so pressing r or R both behave the same, ie: they simply cause the screen to be redrawn.


be dev!/dev/hde1

The dev! prefix is a cue that the binary data is to be provided on demand to BE via BEDEV.

Anything after the prefix are arguments to be passed to BEDEV, and in this case it is the device special file.

You can open a device in read-only mode using :-

be big!RO:/dev/hde1


Because BEDEV works by actually manipulating an open device special file, there are never any unsaved changes - ie: all changes are immediately placed into the device. Bear this in mind before making changes. If you quit the editor, you'll not be given the opportunity not to commit the changes.

Example use

I once unintentionally deleted a photograph on my digital camera.

So I took out the Compact Flash IBM Microdrive and plugged it into my Linux PC, using a Compact Flash to pcmcia converter, and pcmcia card reader.

The Linux pcmcia software fabricated /dev/hde1 to represent the partition on the Microdrive and auto-mounted it.

I then invoked BE using BEDEV on it.

I discovered there was a FAT filesystem, with 8KB cluster size. I threw together a simple BE initialisation file describing the FAT tables and sample directory entries. I was able to find the deleted files directory entry, and repair it. I was also able to hand link together the FAT cluster chain(s), thus recovering the data in the JPEG file I had deleted.

This documentation is written and maintained by the author, Andy Key