4 ms·
Another way to fix this is for your one off write of code, assets, etc at boot time should use O_DIRECT and side step the page and/or buffer cache altogether. T
by tankenmate 2y ago
Another way to fix this is for your one off write of code, assets, etc at boot time should use O_DIRECT and side step the page and/or buffer cache altogether. The performance will be slower, but you won't have a massive page cache overhang for a one time operation.
- Snild 2y agoOr run `sync` after the copy "finishes" -- less focused, but very easy to do.
- mkesper 2y agoThe article states this doesn't change anything.
- throwway120385 2y agosync is not guaranteed to do anything. And sometimes it does way more than it should. Direct I/O semantics are the correct thing here because it bypasses the cache entirely. I've had a lot of issues writing partition and disk images using DD on modern Linux systems because of caching. And these all kept happening even though I would use `sync` like you describe. But setting oflag=direct resolved all of the issues I was having.