4 ms·
TIL /dev/full https://en.wikipedia.org/wiki//dev/full https://en.wikipedia.org/wiki//dev/full
by pmezard 5y ago
TIL /dev/full
https://en.wikipedia.org/wiki//dev/full https://en.wikipedia.org/wiki//dev/full
- rectang 5y agoThat's awesome. I've had to resort to grotesque hacks before to simulate full disks in test suites — e.g. replacing a file descriptor with a nonsense number to trigger an error at the call site where a write would have failed. Now that I know /dev/full exists, I can write a test which, although it works only on a subset of operating systems, still exercises a code path which applies to all of them.
- viraptor 5y agoYou can also create a tiny filesystem in a file, set root user reservation to 100%, mount the file with `-o loop`. That should give you a "real" full device.
- monocasa 5y agoI typically use LD_PRELOAD hacks to simulate failure conditions. That way you can get deeper into your code than simply something that always fails.