I have 2 partitions, my system file, swap.. every thing is on the partition which named now (free space) because I clicked the [-] button. The second partition is the partition where I usually store some important data in and I don't want to erase it.
What I want to do is to Erase the partition which called (free space) safely, mean if someone installed photoRec for example he will not be able to recover my old files. I found here on this website many answers, but all of what I found guides the user to erase all of his disk; but I don't want to do that, I just want to erase one partition, because the secret data is stored there (in free space). I don't know what is the name of this method, maybe it's replacing the free data on the partition with zeros, (I don't know but want the safest). Another question: the hacker can't recover the files on my partition (free space) after erasing it safely even if the another partition (/dev/sda4 ntfs) is still on my device without erasing, true?
The free space shown in the picture is an unpartitioned portion of the disk.
To securely erase it:
1 - Create a partition on free space and format it ext4
2 - Write randoms on all space
3 - Delete created partition
Here is more details for step 2 : how to write randoms on all the free space
Let's say that the partition created from free space is
/dev/sda1
Option 0 : not randoms but fill with zeros
The Ubuntu
gnome-disks
manager have an 'Erase' option which fill with zerosIts quite secure but there is more secure : filling with randoms
Option 1 : Fill with randoms using dd:
sudo dd if=/dev/urandom of=/dev/sda1
Option 2 : Fill with randoms using the secure deletion tool shred
If not present on the system, install it, its part of the package coreutils
sudo apt install coreutils
Usage:
sudo shred -v -n 1 /dev/sda1
option -n 1
is for 1 pass, can be increased for more security and longer process time...