Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to completely delete the contents of the folder /data

Obviously I launched rm-rf * but it's been running from a long time (I have many large files for a total of nearly 1 TB). Given that the folder in question is a mount point for an array of disks in a RAID5 and, in essence, is a disk (/dev/md0) is there a faster way to delete all the data without destroying the array?

Thank you, Greetings to all!

share|improve this question
up vote 2 down vote accepted

Assuming you are not concerned about someone using recovery tools to get the data back ( and if you are you shouldn't be using rm ), then just format the disk.

mkfs.ext4 /dev/md0

Also it sounds like you are currently using ext3, which takes quite a while to delete large files. In the future, you should use ext4 which does not have this problem.

share|improve this answer

If you are concerned about someone recovering your data, use sudo wipe /dev/md0.

share|improve this answer

You can stop the RAID 5 array with this command sudo mdadm -stop /dev/md0.

That will leave you with the individual disks of the array and you can then delete each of them in parallel. This might be a lot faster than just deleting the array.

As to how to delete it, there are lots of options. E.g:

  • apt-get install wipe. sudo wipe /dev/sdX (make sure you specify the right drive!).
  • mke2fs /dev/sdX (or mke3fs, mke4fs, mkbfs, ... anything which formats will do).
  • dd if=/dev/zero of=/dev/sdX bs=1M. (write lots of zeros all over the disk).

The fastest and most secure method however would be to ask the disk to wipe itself. Either by using hdparms to send the drive the secure erase command, or by booting DBAN.

In all cases: Make sure you specify the right drives!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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