This is a known [
1,
2] Linux kernel issue, or, more precisely, a configuration issue: by default writeback buffer is very large, tuned for server workloads. It is not limited to windows2usb, you'll see this behavior on a simple big file copy with a file manager.
This could be fixed by either of:
- Reducing writeback buffer. Very simple one time configuration:
echo 'vm.dirty_bytes = 67108864' | sudo tee /etc/sysctl.d/60-dirty.conf
echo 'vm.dirty_background_bytes = 16777216' | sudo tee -a /etc/sysctl.d/60-dirty.conf
sudo sysctl --system
- Enabling Writeback Throttling feature. If you have this issue, most probably your distro compiles kernel without BLK_WBT_SQ flag and you're using default I/O scheduler. If the kernel is compiled with BLK_WBT_MQ (MQ, not SQ), then you can switch the disk to mq-deadline scheduler to make throttling work. Something like this:
echo mq-deadline | sudo tee /sys/block/sda/queue/scheduler
This could be configured on boot with elevator=mq-deadline kernel command line.
Appimage build contains autofsync library, which limits writeback data in userspace. It should help and works for me. If it doesn't, please report. ArchLinux AUR script may include autofsync as well (replace 7z with a shell script which sets LD_PRELOAD to autofsync and executes real 7z binary with it).
I don't want windows2usb to tune writeback values or change I/O scheduler
automatically, because that's potentially unwanted feature. I totally understand your frustration with Linux defaults, but it has nothing with this tool.