So far as we are going through the course, we interacted with the file system quite often.
We also learned how to download and upload files, how to share files securely with friends and contacts,
how to remove metadata that can be used to anonymize us or get information about us.
So before moving to the next section, I think there is still one missing piece, which is how to properly
delete files and wipe storage media.
Now in general, in operating systems, when you right click a file and delete it, or even if you delete
it and empty your recycle bin or your trash, the file doesn't actually get deleted.
What happens is the operating system marks the file or marks the space that the file was occupying on
the storage device as available.
So the data of that file will still exist on your storage device until that space is overwritten with
other data.
That's why we see so many tools that are very easy to use that you can use to recover deleted files.
Now, these are very simple tools that you can download from the Internet for free, so you can only
imagine what a resourceful adversary can do.
So because deleting a file doesn't actually delete the content of it or its data unless it's overwritten
with other data.
There are tools that will randomly fill up that space of that file with random data so that it's more
difficult to recover that file.
Now, Thales comes with such tools preinstalled, as you'd expect.
So if we go to our file manager.
And go to the file that we want to delete.
So in my case, it's in files.
It's this image right here.
Now I can right click the image and just click on Move to Trash, which will literally just move it
to trash similar to any other operating system.
And then I'd have to go to the trash, right click and empty.
And like I said, this will still not delete the content of this image or the data of this image from
my storage.
The better option to go to if you want to securely remove this file is to click on Wipe right here.
Now if you click on that and expand the options in here, you'll see that it will ask you for the number
of passes of random data that will be executed to overwrite the location that contains the data of this
image.
So by default, this is set to two, which should be good enough for most hard disks.
You can set it to 38 for older ones, or one which is not very secure, which will only protect you
from the very simple software that you can download on the internet.
Now, this method will work on hard drives, but it won't work on USB sticks or solid state drives.
Now, if you don't know the difference between hard drives and solid state drives, then I highly recommend
you go and do some reading on that.
I will include links in the resources of this lecture, but basically the way that solid state drives
work, they don't have sectors.
They use cells in order to store your data.
And even if we use a tool similar to this tool right here in order to overwrite a specific location
of this solid storage device, the logic inside the storage device will probably overwrite the request
that we make in order to increase the life of the device.
Therefore, you might use this click on wipe and think that it works, but it might actually not work
as you would expect it.
So you can only properly rely on this method if you're using a hard drive and not a solid state drive
or a USB device.
Now that's for removing one specific file, but what if we wanted to clean all the free space or all
of the available space on the system?
Now, this is only relevant if you're using persistence, obviously, and you might want to do this
because you've deleted a number of files insecurely.
So by literally moving them to trash and empty in the trash and then the contents of these files, like
I said, will still be recoverable from your storage device.
Therefore, what you want to do is you want to right click any empty space in your file manager, click
on wipe available disk space and you'll get a very similar window to the one that we just got with the
same options.
And once you set the options, you click on wipe and that'll clean and that'll securely clean the available
disk space so it won't delete the files that you have.
It will only clean the available disk space, filling it with random data to make sure that it can't
be used to recover the files that you deleted.
So it will only clean the files that you deleted.
It won't affect anything that you already have on your storage device that you did not delete yourself.
Now this is great, but again, it won't work as expected when it comes to solid state devices and to
USB devices for the same reason that I mentioned earlier.
Therefore, if you're using a solid state device or a USB device and you want to securely delete all
of the data that you have on it, then you have two options.
First option is physically destroy that device.
So you can burn it, put it in a microwave, do whatever you want, really.
Or the other option is to securely format the device and wipe it.
And I'm going to show you how to do that in the next lecture.