Partgrator – automated data migrations on ext fs corruption

  • ATTENTION! You'll notice a Prefix dropdown when you create a thread. If your post applies to one of the topics listed, please use that Prefix for your post. When browsing the thread list you can use the Prefix to filter the view.
  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.


New Around Here
Tired of having a corrupted USB once in a while after rebooting/powering-off your Asuswrt-Merlin router?

Introducing partgrator, a collection of scripts that automate the task of keeping ext filesystems free from corruption caused by forced power-offs and reboots without being safely unmounted and ejected.

Babysitting USBs to keep enjoying Diversion, Skynet and company is now a story of the past!

Whenever a corrupted partition's filesystem is detected, partgrator migrates the corrupted partition's data into a freshly formatted partition to prevent the corruption from escalating. This procedure is 100% safe, no data loss can occur even if the system is powered off during the migration. Interrupted migrations will be tried again when the corrupted partition is once again detected by the system.

It won't feel like tossing a coin into the air anymore after a power outage, fit partgrator to your needs once and forget it forever.

Note that partgrator cannot guarantee the data's integrity on filesystem corruption, but it is good enough to prevent it for the typical USBs used by network filtering scripts. If it is not enough, you can always ensure the data's integrity with your own backup and restore scripts. Learn more here.

Partgrator requires a USB partitioned in a specific way, a disk-check-like script that executes e2fsck (amtm's disk-check works), and the ability to properly unmount partitions.

Partgrator installer's usb-creator only sets aside half of the chosen USB device's capacity for the user. If you want to use more space, you'll have to perform a manual configuration for a multi-partition setup.

Partgrator's installation and migration procedures require proper disabling of the scripts using the USB temporarily to allow mounting and unmounting the chosen device cleanly. See how to do it here.

Install the scripts and start the usb-creator in one go with the one-liner:
{ echo '{ ('; curl -s -L ''; sh -c 'echo "); kill -s INT $$ 2>/dev/null; }"; exec cat'; } | { batch_mode=0 sh 2>&1; } | ( trap '' EXIT KILL QUIT INT; exec cat >&2 )
After too many years (and too many burned flash drives) praying before plugging the router back in the mornings just to see if one could enjoy the freedom filter scripts give when browsing the now ad-free internet without having to waste any minute fixing the router's usb ext partition requiring manual intervention, @caribpa decided to step in once and for all.

Find how it works, troubleshooting, customization and other details in the project page.


Part of the Furniture
This looks great! Thank you.

And the natural question now...

When will this be integrated with amtm? :)


Very Senior Member
Great job, congratulations! It is an indispensable solution for USB expansions with AMTM. I suggest you work with the AMTM and NVRAM Save and Restore team. Essential.

Latest threads

Sign Up For SNBForums Daily Digest

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