0

I want to sell my old 4TB Hard Drive. Of course I want no one to steal my data.

Overwriting the whole drive with zeros with dd if=/dev/zero of=/dev/sda would take about 18h. But I cannot reboot my PC for 18 hours because I think dd always starts writing at sector 0 so it cannot continue and would start from the beginning again every time.

Of course, I could note down the amout of bytes written by dd before rebooting (monitoring it with status=progress) but that seems a bit complicated.

I don't want to keep my PC on for 18h just to erase the disk because this wastes about 80 watts power per hour.

How about this:

I format the disk with ext4. Then I write the dd output to actual files on the mount disk while I actually use the PC. Then, the next time I boot the PC to use it, I write dd output to a different file. So the files stay there and occupy the disk space step by step.

Two questions:

  1. with a formatted disk, will dd also write all sectors until the last one with zeros? Or will there be remaining some unused space at the end of the partition or behind the partition where old files could be reconstructed from the binary image?

  2. I'm pretty sure that before the actual start of the partition, there will be remaining some disk space for the partition table etc. So in theory, in that area, also some files could be reconstructed because dd would not overwrite that disk area, right? Would a valid workaround be just overwriting the first 20GB or so of /dev/sda so that this area is cleared, too?

dfsg76
  • 529
  • 4
  • 7
  • 1
    Can't you just use dd to write, say, 1 TB at a time? With the right options, you'll be done in about 4 steps. This sounds like a question for Superuser.SE. From a security point of view though, I have to say that for the risk involved (confidentiality of your personal data on the HDD), you should probably be willing to "invest" those 18 hours of computing power. – reed Oct 09 '20 at 13:46
  • That is a good idea. I think it is possible to specify start and end blocks for dd, right? – dfsg76 Oct 09 '20 at 14:06
  • Yes, I'm not an expert, but what you need to look up are the options: bs (ibs and/or obs), seek, count. Read the manual for more info (man dd). You might also find the following answers interesting: https://unix.stackexchange.com/questions/134299/what-is-the-difference-between-bs-count-and-seek-in-dd-command – reed Oct 09 '20 at 15:27
  • Just an FYI concerning energy consumption: Your computer uses 80 watts of power continuously (not per hour). If you leave your computer on for one hour, that uses 80 watt-hours of electricity. If you leave your computer on for 18 hours, that will use 1440 watt-hours of electricity, or 1.44 kilowatt-hours. I'm not sure if your reasons for not wanting to run your computer for 18 hours are environmental or for cost savings, but 1.44 kilowatt-hours is not a lot of energy. In the US, electricity costs are about 10 cents per kilowatt hour, so this would equate to about 15 cents. – mti2935 Oct 09 '20 at 15:50
  • Throw in a **bs=16M** parameter. The default block size is 512 bytes on *dd* , this results in a lot of unnecessary overhead and slowing. Outputting to *sda* vice sda**1** targets the disk not the partitions so there is no concern about space before or after the partitions. When it finishes there will not be any partitions. – user10216038 Oct 09 '20 at 16:39

0 Answers0