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?

  • Also see askubuntu.com/questions/21501/… – 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

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.

  • 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 5: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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.