3 ms·
No need to sync before rm'ing?
by geoka9 5y ago
No need to sync before rm'ing?
- willis936 5y agoNot afaik. The dd operation returns when the virtual disk is full and linux won't run anything after the semicolon until the previous command returns. I'm not running any async disk behavior on the client.
- yoursunny 5y agoIn case the second sudo wants to ask for password but there's no disk space for logging, it's safer to: sudo bash -c 'dd if=/dev/zero of=/zeros; rm -f /zeros'
- willis936 5y agoI typically don't put sudos in my scripts but have found filling all free space is particularly hazardous. I ran into rm permissions issues once and had to sneak my way into a recovery environment to remove the file. I haven't ran into sudo timing out during the zeroing, but it is a hazard. This is a good tip.