So you want to hide directory names... an experiment.
# truncate -s 1G foobar
# losetup -f --show foobar
/dev/loop0
# mkfs.ext4 /dev/loop0
# mount /dev/loop0 /mnt/tmp
# cd /mnt/tmp
# mkdir collywobbles
# sync
# mv collywobbles shriggelfigs
# sync
# mv shriggelfigs flapjacks
# sync
# rmdir flapjacks
# cd ..
# umount /mnt/tmp
So basically we have an empty filesystem, created a directory in it, renamed it twice and deleted it in the end. What is recoverable?
# strings /dev/loop0 | grep -E '(collywobbles|shriggelfigs|flapjacks)'
flapjacksles
shriggelfigs
flapjacksles
shriggelfigs
collywobbles
shriggelfigs
Ah. All of it. Great. Although flapjacks
at least seems to have overwritten two collywobbles
, turning it into flapjacksles
since flapjacks
just was a bit shorter...
How to securely delete a directory without leaving a trace?
You can't securely delete a single file, or indeed get properly rid of a directory name. At best, you can overwrites the contents of the current representation of a file that the filesystem still knows about. Ever created a copy of the file? Ever edited and saved the file? Too bad, there's probably a copy the filesystem itself no longer knows about because it was deleted, and replaced with a file that has the same name.
You can shred
files. You can also shred
the entire free space of the filesystem. That's good for getting rid of about 99% of it. If that's not good enough, you have to go all out. You never know if it's really gone until you do the full thing.
Copy all data off. shred -v -n 1 /dev/thedisk
. Copy the data back (only the bits you want to keep).
README
file it seems to me that all it does with directories is rename their entries. – Dan Getz Aug 01 '14 at 20:38