LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   linux utility to zero out hard disk (https://www.linuxquestions.org/questions/linux-newbie-8/linux-utility-to-zero-out-hard-disk-4175422161/)

ashishyadav26 08-15-2012 04:07 AM

linux utility to zero out hard disk
 
Hi, I use dd to zero out hard disk.
dd if=/dev/zero of=/dev/sdb2

is there a utility which dose the same but is faster, dd is terribily slow.

Mr. Alex 08-15-2012 04:41 AM

Code:

dd if=/dev/zero of=/dev/sdb2 bs=1M
will be somewhat faster.

Also use forum tags for code and quotes.

TobiSGD 08-15-2012 05:21 AM

As Mr.Alex stated, play with the blocksize option (bs) the standard value for that option is 512, which means that 512 Bytes are copied at a time (which is/was for a long time the standard sector size of harddisks). You can get much better performance with larger values. Which blocksize is optimal for you depends on your hardware, I got good results with blocksizes between 8 and 32 MB, Mr.Alex seems to prefer a blocksize of 1MB. Just try some values here and see which one gives you the best performance.

Mr. Alex 08-15-2012 05:39 AM

One more thing worth to be looked at: http://dave.frop.net/disk_overwrite_...vs_dd_vs_shred .

TobiSGD 08-15-2012 05:56 AM

Quote:

Originally Posted by Mr. Alex (Post 4754551)
One more thing worth to be looked at: http://dave.frop.net/disk_overwrite_...vs_dd_vs_shred .

Just keep in mind that in this comparison the disk is not zeroed out, but overwritten with (pseudo) random-numbers from /dev/urandom. /dev/zero is much faster than /dev/urandom:
Code:

tobi@demon ~ :) % dd if=/dev/zero of=/dev/null bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 0.124797 s, 8.4 GB/s
tobi@demon ~ :) % dd if=/dev/urandom of=/dev/null bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 63.3325 s, 16.6 MB/s

This may have an impact of the best blocksize for that task.

ashishyadav26 08-15-2012 06:09 AM

Thanks
 
Thanks next time I will try out these options.


All times are GMT -5. The time now is 03:07 PM.