From b85eb8d6835e7665bf6151db070261b123c22f95 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Fri, 4 Apr 2014 13:35:56 +0100 Subject: shred: overwrite inode storage used by some file systems * doc/coreutils.texi (shred invocation): Mention some reasons why clearing slack space might be useful. * src/shred.c (do_wipefd): Add initial writes for each pass for small regular files in case the storage for those is in the inode, and thus a larger write up to a block size would bypass that. Move the direct I/O control to... (dopass): ... here so we can avoid enabling it for these small initial writes. It's better to retry direct I/O for each pass anyway to handle the case where direct I/O is disabled for only the last portion of a file when the size is not a multiple of the block size. Note we don't avoid the sync for the initial write as it will be small but more importantly could be on a different part of the disk and so worth doing independently to ensure the write is not discarded. * tests/misc/shred-exact.sh: Check some more direct I/O cases. * NEWS: Mention the improvements. The inode storage issue was mentioned by Paul Eggert. --- tests/misc/shred-exact.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/misc/shred-exact.sh') diff --git a/tests/misc/shred-exact.sh b/tests/misc/shred-exact.sh index 5f2848e1d..5434229c4 100755 --- a/tests/misc/shred-exact.sh +++ b/tests/misc/shred-exact.sh @@ -40,6 +40,10 @@ done # (i.e. we want to test failed writes not at the start). truncate -s1MiB file.slop || framework_failure_ truncate -s+1 file.slop || framework_failure_ -shred --exact -n1 file.slop || fail=1 +shred --exact -n2 file.slop || fail=1 + +# make sure direct I/O is handled appropriately at start of file +truncate -s1 file.slop || framework_failure_ +shred --exact -n2 file.slop || fail=1 Exit $fail -- cgit v1.2.3-70-g09d2