2

Installation type window Ubuntu

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?

andrew.46
  • 38,003
  • 27
  • 156
  • 232
sam islam
  • 111
  • 6
  • The free space is not allocated to a partition; I see only a single partition being sda4 (ntfs). Free space is unallocated to any partition; dev sda is the physical disk itself (not a partition). I'm confused by what you see as the 'second' partition as I only see one (sda4) – guiverc Jul 14 '19 at 04:07
  • Me too, I don't know any thing, the only thing I know that my linux was on that free space before I clicked the [-] button. – sam islam Jul 14 '19 at 04:11
  • Use the space for something else (ie. make a partition there, and fill it with junk, or write 0101010 etc. on it, then something else or 1010101, then erase the partition so it' free again) - i'm still confused by your question though. – guiverc Jul 14 '19 at 04:12
  • Maybe the question should be: I want to make safe erase for this (free space) not for the /dev/sda4 ntfs. – sam islam Jul 14 '19 at 04:13
  • Thank you because you're trying to help me guiverc, okay I made a partition there, but this is a very big space 262GB how I'll fill all of this free space? What is the best way? – sam islam Jul 14 '19 at 04:19
  • I would dd data to it. (/dev/random) but I'll mark it duplicate which will provide links – guiverc Jul 14 '19 at 04:28
  • Possible duplicate of https://askubuntu.com/questions/17640/how-can-i-securely-erase-a-hard-drive (how can I securely erase a hard drive) – guiverc Jul 14 '19 at 04:29

1 Answers1

2

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 zeros
Its 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...

cmak.fr
  • 8,696
  • The "format it ext4" part of step 1 is not needed here: It is sufficient to create an unformatted partition to apply any of the options described here. – Juergen Sep 14 '23 at 12:53