Skip to content

[cmds] Enhance fsck-dos to work with large 32M hard drives#2399

Merged
ghaerr merged 2 commits intomasterfrom
fsckdos
Oct 12, 2025
Merged

[cmds] Enhance fsck-dos to work with large 32M hard drives#2399
ghaerr merged 2 commits intomasterfrom
fsckdos

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Oct 12, 2025

This now allows for 32MB and smaller hard drive DOS FAT images to be consistency checked.

When compiled with OWCC, fsck-dos.os2 uses huge pointers to work with the much larger FAT table found in ELKS 32MB FAT hard disk images. To check a 32MB hard drive, there must be > 256KB of contiguous main memory available, which may not be the case with multiple logins or shells running.

Hopefully this tool might help @tyama501 with the possible HD FAT corruption seen in #2398.

The source code for fsck-dos was somewhat easily enhanced to use __huge far pointers, which causes OWCC to generate additional code for indexing huge far pointers into > 64KB contiguous RAM allocated through fmemalloc. The standard malloc/free were then replaced with an enhanced version developed for the 8086-toolchain, where two far memory arenas are maintained, one for small allocations using _fmalloc, and the other using fmemalloc.

For the time being, this requires OWCC being installed on the host. To build the enhanced version, type:

# cd elkscmd/fsck_dos
# make fsck-dos.os2
# cp fsck-dos.os2 ../rootfs_template/root
# cd
# ./fsck-dos.os2 /dev/hda1
Screenshot 2025-10-11 at 9 22 26 PM

For those without OWCC, here's a pre-compiled binary:
fsck-dos.os2.zip

@ghaerr ghaerr merged commit 118899d into master Oct 12, 2025
1 check passed
@ghaerr ghaerr deleted the fsckdos branch October 12, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant