I have deleted a file on a FAT16-formatted flash drive with rm
.
I can see that the file is still recoverable using testdisk
or fls
.
Is there a way to securely delete the (already deleted) file, without destroying other data on the flash drive?
I have deleted a file on a FAT16-formatted flash drive with rm
.
I can see that the file is still recoverable using testdisk
or fls
.
Is there a way to securely delete the (already deleted) file, without destroying other data on the flash drive?
You might want to look at the shred
command, which is written explicitly for this purpose.
However, at the end, you talk about a "flash drive." If you mean solid state storage (USB Stick, SSD, etc.), then thanks to advanced features like wear leveling, you really have no way of knowing if you're overwriting the old data.
This is why FDE is much more important today than years ago; recoverable data never touches the disk.
cat /dev/zero > /media/flash/EMPTY
sync
rm /media/flash/EMPTY
Since the maximum file size for fat32 is 4GB minus 1 byte, you may need to create several empty files to wipe the entire free space.
Some pieces of the file (if you've changed its size) can still remain in the ends of other blocks.
If you want to make sure it's not recoverable, backup all the files, wipe the disk using dd
or shred
, recreate the filesystem, restore the files.
dd
isn't guaranteed to wipe out an SSD.
– Aaron D. Marasco
Aug 22 '20 at 12:54
EMPTY
on the drive as large as the formerly free space of the flash drive. This indeed overwrote the old deleted file, making it unrecoverable with testdisk
. I was hoping to get the beginning and end of the deleted file and overwrite that, since it's faster than filling the whole flash drive with zeros.
– Matthias Braun
Aug 22 '20 at 16:27
fat32
is 512
bytes https://support.microsoft.com/en-us/help/140365/default-cluster-size-for-ntfs-fat-and-exfat , so I didn't specify bs=SIZE
for dd at all. 512
is also the default block size for dd
.
– Artem S. Tashkinov
Aug 22 '20 at 18:16
shred
, which is why I noted it. As for accessing outside of what the controller lets you touch, physical access to the ICs means you can do anything. Your answer is valid for the question asked and deserves to be voted on appropriately.
– Aaron D. Marasco
Aug 22 '20 at 22:09
shred
works only before removal of the file and only on RHD ( Rotational Hard Drive ). – dan Aug 22 '20 at 13:07shred
is great, but how can I overwrite the already deleted file with it? I have to provide a file path toshred
. – Matthias Braun Aug 22 '20 at 16:01