11

I have a 60 GB SSD where my Ubuntu installation and home folder is and a 1 TB HDD that I used to use as storage device (movies, music..). I have decided to sell the 1 TB drive but before I do that I want to completely erase all data on it or at least make it unrecoverable by most software out there. What I want to do is the following:

dd if=/dev/urandom of=/dev/sdc

and then quick format the drive using Disks utility.

My question is this: do I need to unmount the /dev/sdc before I proceed with the dd command?

A.B.
  • 90,397
sinisa
  • 113
  • Also see http://askubuntu.com/questions/21501/possibility-of-recovering-files-from-a-dd-zero-filled-hard-disk – Rinzwind Aug 20 '15 at 14:13
  • 1
    Just umount it. That's always the best policy. That way no programs will be trying to access it while dd is wiping their data away. – Daniel Aug 20 '15 at 14:50
  • Thank you for your comments. Is there an option where I note that this question has been answered or do I leave it as is? – sinisa Aug 21 '15 at 23:17
  • 1
    dd if=/dev/zero would possibly be much faster. – AlexP May 28 '18 at 18:09

3 Answers3

13

It's possible (checked in this moment) but it's highly advisable to umount the device before a dd.


This may be not a problem in your special case if=/dev/urandom, but in other cases:

If is some activity on that partition during the dd command, there is no guarantee that you partition isn't broken.

A.B.
  • 90,397
  • I was too impatient to wait for your answers so I did it anyway - I've let dd do the work on the mounted device. It didn't give me any errors while I was running it but it did suggest a MASSIVE time needed to complete the task. The way I found out about the time is that I installed a package called "pv" that gave me a number of neat little stats about the progress of dd command. So the command I entered looked like this: sudo dd if=/dev/urandom | pv | sudo dd of=/dev/sdc – sinisa Aug 21 '15 at 23:02
  • The writing of random data peaked at 13MB/s which would make total time for 1TB drive abound 24h. That's a lot of time. – sinisa Aug 21 '15 at 23:09
  • 1
    if you just want to make your data unrecoverable, why not use /dev/zero? 1TB should only take a couple of minutes. – Steve Zhan Apr 14 '17 at 05:42
  • 1
    If there is a swap partition, you can use the swapoff command. swapoff /dev/sda2 if sda2 is the swap area – linux64kb May 27 '17 at 10:31
1

You should boot into a Live USB and unmount the disk you are trying to erase. If you absolutely must, you can try remounting the root filesystem as read-only using Alt+SysRQ+u, then use dd if=/dev/zero of=/dev/sdX where /dev/sdX is your disk. You really should consider using a Live USB though, since it is MUCH safer.

0

The srm (secure-remove) utility provides several options/patterns for overwriting previous disk contents.

Some of these options are secure enough to ensure that forensic disk scans will not be able to recover the previous files; but: more security = lengthier overwrite process.

To install srm type:

sudo apt install secure-delete

to use:

srm szFileName
Fabby
  • 34,259