A failed attempt to copy a 46 MB file to a USB drive turned into a lesson in why file transfers can make a computer appear frozen. The copy would not stop with Ctrl+C or SIGKILL, and the author eventually pulled out the drive, corrupting its data. The underlying problem was not simply a slow USB: while copying, the Linux kernel was handling file-system work that could not be interrupted. SIGKILL can stop an ordinary userspace program, but it must wait when the kernel is occupied with an uninterruptible task.
The explanation centers on how the kernel writes data in the background. Normally it handles work in manageable chunks, returning control often enough for the system to update the progress bar and respond to other tasks. In this case, large batches of pending disk writes kept the kernel busy for long stretches, leaving the computer unresponsive and delaying signals. The proposed fix was to lower the relevant dirty-memory thresholds in /etc/sysctl.conf by setting vm.dirty_background_ratio to 5 and vm.dirty_ratio to 10, then applying the settings with sudo sysctl -p. The transfer still took time, but the computer remained usable. The account also stresses that the failure arose from several conditions combining - booting Kali from USB, copying to a slow USB drive, and the file’s size - rather than from one isolated flaw.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.