Create and Verify an SCO BFS Filesystem with mkfs.bfs

mkfs.bfs builds the SCO BFS filesystem that legacy UnixWare software expects, and it is destructive the moment you point it at a real partition. You will create one in a temporary disk-image file, check the result is really BFS, and see which values mkfs.bfs chose. The same command can format a partition, but that operation destroys its existing contents. Allow about fifteen minutes for a test image, or longer if you must plan a real device change.

This guide follows the local mkfs.bfs(8) page from util-linux 2.39.3. On this machine, dpkg reports util-linux 2.39.3-9ubuntu6.6, while the shell currently resolves mkfs.bfs from Homebrew util-linux 2.41.3. Check your own executable before relying on version-specific output.

1. Check the executable you will run

Run these commands as your ordinary user:

$ command -v mkfs.bfs
/home/linuxbrew/.linuxbrew/sbin/mkfs.bfs
$ mkfs.bfs --version
mkfs.bfs from util-linux 2.41.3

The command takes a device and an optional block count. The filesystem block size is 512 bytes, but the block count is not a byte count. Use --help if you need to confirm the options provided by the executable in your path.

Checkpoint: if command -v finds nothing, stop and install or select the util-linux command through your normal package-management process. Do not copy a filesystem command from another host without checking which version will run.

2. Make a disposable image

Formatting is destructive. A regular file gives you a safe rehearsal without selecting a disk or partition. This example creates a 128 KiB file in /tmp:

$ testdir=$(mktemp -d /tmp/mkfs-bfs-XXXXXX)
$ truncate -s 128K "$testdir/image"
$ ls -lh "$testdir/image"
-rw-r--r-- 1 ... 128K ... /tmp/mkfs-bfs-XXXXXX/image

Keep the generated path in your shell. The file is disposable, but it is still the target of the format operation. No elevated privilege is needed for a file you own.

3. Create the BFS filesystem

Use explicit names and an inode count for a repeatable test:

$ mkfs.bfs --lock=yes --verbose --inodes=48 --vname=TEST --fname=BFS "$testdir/image"
Device: /tmp/mkfs-bfs-XXXXXX/image
Volume: <TEST  >
FSname: <BFS   >
BlockSize: 512
Inodes: 48 (in 6 blocks)
Blocks: 256
Inode end: 3583, Data end: 131071

Your temporary-directory suffix and ownership line will differ. The useful checks are exit status 0, a 512-byte block size, 48 inodes and 256 blocks for this 128 KiB image.

4. Verify the image without mounting it

First check the command status immediately after formatting:

$ printf 'mkfs status: %s\n' "$?"
mkfs status: 0
$ file "$testdir/image"
/tmp/mkfs-bfs-XXXXXX/image: SCO UnixWare BFS filesystem

The file description is a useful independent check that the image has a BFS signature. You can also inspect the first bytes without changing the image:

$ od -An -tx1 -N32 "$testdir/image"
 ce fa ad 1b 00 0e 00 00 ff ff 01 00 ff ff ff ff
 ff ff ff ff ff ff ff ff ff ff ff ff 42 46 53 00

Do not infer that a successful format makes the filesystem suitable for a particular legacy application. Mounting support, expected field values and compatibility with the consuming SCO or UnixWare software are separate questions; the local manual only promises creation of the filesystem.

5. Format a real partition only after a checkpoint

When you deliberately need BFS on a real block device, replace the placeholder with the exact partition and use elevated privilege only for that operation:

$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/PLACEHOLDER
$ sudo mkfs.bfs --lock=yes --verbose --vname=LEGACY --fname=BFS /dev/PLACEHOLDER

Warning: stop if the device path, size or current filesystem is not exactly what you expect. Do not use a whole-disk path when the intended target is a partition. Unmount the target first if it is mounted, and make sure you have a tested backup. The command has no undo operation: restoring the previous filesystem means restoring its backup or recreating it from the original source.

You can supply a final block count when the filesystem must occupy only part of the device, for example 256 for the 128 KiB test image. Omit it and mkfs.bfs uses the entire partition. Do not guess a count from a decimal byte size; calculate it in 512-byte blocks and check the verbose output.

6. Avoid option and failure traps

Use --version for the version query. -V is the volume-name option in normal use, although the manual gives -V a special version meaning when it is the only option. Writing the long form stops a script confusing a label with a version request.

The options -c and -l are silently ignored by this command: they do not request a bad-block check or a label file. A non-zero exit status means something went wrong; keep the original device untouched until the diagnostic is understood. On the test run above, an overlong volume name caused status 1 before the image was formatted.

For a failed test, discard the temporary image and directory using your normal temporary-file cleanup once you have captured any diagnostic. For a failed real-device attempt, do not immediately retry with different flags. Recheck the selected device, permissions, lock contention and available space, then consult the local manual and system logs.

Done means