Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

m65defrag — MEGA65 SD card defragmenter

Scans the SD card on a MEGA65 (via ethernet / ETHLOAD) and rewrites fragmented files into contiguous clusters.

Build

make            # builds bin/m65defrag

Object files and the static library libm65ftp.a are built under build/ (mirroring lib/ and src/); make clean removes build/ and bin/.

The Makefile detects the platform automatically (uname -s).

  • Linuxgcc, make
  • macOS — Xcode command line tools (uses cc/Clang), make
  • Windows — MSYS2/MinGW64 (uses gcc, make)

Ethernet-only — no USB/serial dependencies. On Linux the binary links against libc only.

Usage

./bin/m65defrag [root]

Connects to the MEGA65 (ETHLOAD must be running), scans the directory tree under root (default /), marks each file OK or FRAGMENTED, and rewrites any fragmented files in place so they occupy contiguous clusters.

Screenshots

Scanning the SD card 1

Scanning the SD card 2

Layout

lib/                  vendored MEGA65-FTP library (ethernet only)
src/m65ftp_lib.[ch]   local wrapper over the vendored core
src/m65defrag.c       CLI (scan + defrag mode)

The vendored library is a stripped copy of the MEGA65 FTP tool from MEGA65/mega65-tools, so the same MEGA65-FTP protocol as upstream's mega65_ftp is used. See lib/README.md for the vendored library's provenance and the local deltas, and scripts/sync-upstream.sh (Linux), scripts/sync-upstream-mac.sh (macOS) or scripts/sync-upstream.bat (Windows) for refreshing it.

License

The vendored lib/ code is copyright the MEGA65 project and is licensed under the GNU General Public License, version 3 (LICENSE.txt); lib/mega65_ftp.c carries a per-file GPL-2.0-or-later header. See lib/README.md for the exact provenance. This project's own code (src/) is distributed under the same terms.

Disclaimer

USE AT YOUR OWN RISK. This tool modifies the FAT32 filesystem on your SD card. While it has been tested, there is always a risk of data loss or corruption. The author makes no warranties and accepts no responsibility for any damage or data loss that may occur. Back up your SD card before use.

About

Standalone ethernet-only MEGA65 SD card defragmenter (FTP/ETHLOAD)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages