defrag.exfat(8) System Manager's Manual defrag.exfat(8)

defrag.exfat - Defragment or assess fragmentation on an exFAT filesystem

defrag.exfat [-f | -a] device

defrag.exfat -h | --help

defrag.exfat -v | --version

defrag.exfat is a utility to defragment files on an exFAT-formatted device or assess its fragmentation status.

When no option is specified, the tool warns the user to run fsck.exfat first for filesystem consistency.

This safety prompt can be bypassed using the -f option.

The -a option enables assessment mode, which analyzes fragmentation without modifying the filesystem.

defrag.exfat provides whole-disk defragmentation based on cluster swapping, which incurs a certain amount of wear overhead on flash-based storage devices with low fragmentation levels.

Therefore, it is recommended to use defrag.exfat on mechanical hard disk drives (HDDs) or flash-based devices that exhibit a relatively high degree of fragmentation.

Perform defragmentation without prompting the fsck warning. Use with caution.
Assess the fragmentation status of the exFAT volume without making any changes.
Display version information and exit.
Show usage information and exit.

Defragment an unmounted exFAT device (with safety warning):

$ defrag.exfat /dev/sda1

Defragment without prompting (force mode):

$ defrag.exfat -f /dev/sda1

Assess fragmentation status (read-only):

$ defrag.exfat -a /dev/sda1

Show version:

$ defrag.exfat -v

Show help:

$ defrag.exfat -h

Before defragmentation:

-
The target device must be unmounted.
-
Please run fsck.exfat on the target device to ensure filesystem integrity.
-
Considering the potential risks of defragmentation, critical data should be backed up in advance.

During defragmentation:

-
Always keep the device connected and powered.
-
If the device is removed, powered off, or experiences a hardware failure, the filesystem may become corrupted.