What's new

[User Script] USB Disk Check at Boot or Hot Plug (improved version)


Part of the Furniture
Merlin's firmware version 384.11 and John's V39E1 introduced an enhancement to the pre-mount user script that makes identifying the filesystems present on a USB disk more reliable. This can be used to create improved versions of the current scripts that automatically check or repair disks (i.e. fsck).

For more information and example scripts see the wiki here.
The purpose of this guide is to provide example pre-mount scripts that can be used to automatically check and repair the filesystems of USB storage devices during boot or when they are plugged in. This might be desirable because after the router has automatically mounted a filesystem it can sometimes be difficult to unmount it for checking. This is especially true if that filesystem is used by third-party software such as Entware.

These scripts contain the following improvements over the original script:

1. Compatibility with GPT disks (GPT is required for disks larger than 2TB).
2. Reliable detection of the filesystem type.
3. Disk check commands compatible with both Merlin's and John's firmware.
4. Support for HFS filesystems.
5. Detection of swap partitions.
For people that don't want to write their own script @thelonelycoder has updated amtm to include this enhanced method. He has also retained the previous method for compatibility with older firmware releases.


Very Senior Member
Thank you.
I have incorporated it in my "pre-mount" script and set maximum mount count: to 20 times.
tune2fs -c 20 /dev/sda1

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!