0

i did a 'new install' of ubuntu on an old windows laptop. I probably will sell/donate this machine and want to 'rewrite' all the free disk space because i think when ubuntu created new 'partion tables?' , my old data is still there physically on disk

is there a simple linux app or command that can maybe rewrite all the free space with garbage data, it doesnt have to be NSA grade security :) ?

  • 1
    shred from the coreutils package should do the job if you don't trust format. – ubfan1 Mar 05 '23 at 03:12
  • 1
    @ubfan1 - i will try the shred app... but btw - its not that i dont trust format...but i think format just frees up the disk with a new partiion table... your old 1's and 0's are still there and can easily be extracted by a bad actor.. isnt that the case? – Cool Pontiac Mar 05 '23 at 04:09
  • 3
  • @Terrance actually no. i looked at the shred command. it seems to shred a file(s) that you name... I actually want to shred all the free disk space on my partions so that i can donate my linux laptop and know that my old windows data has at least been written over 1 time. how can i do this? – Cool Pontiac Mar 05 '23 at 04:38
  • Honestly, it would be better to scrub the entire drive and reinstall the OS after the scrub so that there is no data left over whatsoever. I used to do drive scrubs for data centers when they would get rid of servers and sell them. We would scrub them anywhere from 3-7 passes over the entire drive so that there was zero chance of data recovery from bad actors. – Terrance Mar 05 '23 at 04:41
  • Remember, "everything is a file": from the shred man page: "...it is common to operate on device files like /dev/hda". SDD's may have a problem when overprovisioning removes blocks from use -- not sure anything will ever touch those blocks again, but they are still there! – ubfan1 Mar 05 '23 at 17:03

1 Answers1

0

If you wish to completely wipe the disk, leaving nothing behind, this is the process that I generally follow:

  1. Boot into a live session using the Ubuntu installation USB

  2. Open the terminal and directly write random data to the entire disk. Assuming you have just one SATA disk, the command would look something like:

    dd if=/dev/urandom of=/dev/sda bs=1M
    

    Note: This destroys all partitions and all data. There is no undo. Use with care.

  3. (Optional) Install the next OS of choice.

Some people suggest using /dev/zero rather than /dev/urandom, however, some SSDs will not write blocks of zeroes in predictable ways depending on the firmware installed. If you are using a spinning disk, /dev/zero is more than sufficient unless you need to wipe a disk that can escape reconstruction by nation state-level intelligence agencies.

matigo
  • 22,138
  • 7
  • 45
  • 75