We have a large disk on our Linux machine, 2.5TB in size.

We want to completely format this disk; the disk is sdb.

We want to do it with dd:

dd if=/dev/zero of=/dev/sdb bs=1M count=1

My question is Does dd support also to format / clean disk with very large sizes?

And what should be the verification to do after dd, in order to see if the disk has been "cleaned"?

closed as unclear what you're asking by Michael Homer, Jeff Schaller, Rui F Ribeiro, cas, DarkHeart Jan 28 '18 at 1:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It's unclear if this is about data security or whether it's about simply emptying the disk. Ordinarily, newfs creates a new (empty) filesystem. – Kusalananda Jan 27 '18 at 18:51
  • Format a new disk? Make a partition using fdisk or gparted or whatever you like and then mkfs.ext4 (or whatever fs you want to use) on it – ivanivan Jan 27 '18 at 18:52
  • we just want to clesn the sdb disk as a new disk , dose dd give this ability ? – yael Jan 27 '18 at 18:58
  • With count=1 you only wipe the partition table, in that case perhaps you want wipefs instead ( unix.stackexchange.com/a/394999/30851 ). Otherwise get rid of count=1. Verify afterwards with cmp /dev/zero /dev/sdb (should say EOF on /dev/sdb assuming sdb is fully zero). – frostschutz Jan 27 '18 at 19:44
  • You'll find cat /dev/zero >/dev/sdb faster than dd. Really. – roaima Jan 27 '18 at 22:09
  1. dd can be slow in this instance.

    You could install pv with:

    yum install pv
  2. pv could be faster and I would suggest scrambling instead of zeroing, i.e., e.g.:

    pv < /dev/urandom > /dev/sdb
  3. There is no need of checking if this has been done. In this instance, where we would be scrambling instead of zeroing, there is no way anyways.

  4. If you wish to use zeroing instead, simply do:

    pv < /dev/zero > /dev/sdb
  5. If the drive has been zeroed no matter what way, to check it's really zeroed:

    dd if=/dev/sdb | tr --squeeze-repeats "\000" "T"

    Taken from https://superuser.com/a/559794/402107

  • we have redhat machine so apt-get not relevant – yael Jan 27 '18 at 19:04
  • in case of using dd inspite its slow - then how to verify the dd do the job? – yael Jan 27 '18 at 19:05

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