20th March 2017

Wiping Disks

How fast can you wipe a complete disk? For this I dumped zeros to a MS Windows partition based on an SSD formatted with NTFS.

[root@i7 ~]# time dd if=/dev/zero of=/dev/sda1 bs=1M
dd: error writing '/dev/sda1': No space left on device
81920+0 records in
81919+0 records out
85898297344 bytes (86 GB, 80 GiB) copied, 182.699 s, 470 MB/s

real    3m2.703s
user    0m0.033s
sys     0m43.470s

It was a real pleasure to get rid of MS Windows after just 3 minutes ;-)

Once more, second partition on SSD formatted with NTFS.

[root@i7 ~]# time dd if=/dev/zero of=/dev/sda2 bs=1M
dd: error writing '/dev/sda2': No space left on device
147015+0 records in
147014+0 records out
154155352064 bytes (154 GB, 144 GiB) copied, 326.108 s, 473 MB/s

real    5m26.110s
user    0m0.097s
sys     1m21.503s

Now a hard disk, i.e., moving parts, also formatted with NTFS.

[root@i7 ~]# time dd if=/dev/zero of=/dev/sdb1 bs=4M
128459+0 records in
128459+0 records out
538796097536 bytes (539 GB, 502 GiB) copied, 5404.54 s, 99.7 MB/s     <--- from kill -10
dd: error writing '/dev/sdb1': No space left on device
238467+0 records in
238466+0 records out
1000202043392 bytes (1.0 TB, 932 GiB) copied, 11876.6 s, 84.2 MB/s

real    197m56.647s
user    0m0.000s
sys     15m49.763s

From the man-page of dd:

Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying.

For example, in above scenario I used

kill -10 12523

Signal numer 10 is SIGUSR1, see /usr/include/bits/signum.h, or

$ kill -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
 6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR
31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX

Here is another test with an USB 3 Seagate 2 TB hard disk, previously it had ext4:

[root@C ~]# time dd if=/dev/zero of=/dev/sdc1 bs=1M
dd: error writing '/dev/sdc1': No space left on device
1907729+0 records in
1907728+0 records out
2000397795328 bytes (2.0 TB, 1.8 TiB) copied, 21845.9 s, 91.6 MB/s

real    364m5.890s
user    0m1.020s
sys     47m33.056s

Just for clarification, it is irrespective of the previous underlying filesystem if you use dd on the whole disk. dd will happily wipe everything and just write blocks to the disk.

Added 09-Dec-2019: Another test with an Elitebook 840 G3 SSD:

root@elitebook /root# time dd if=/dev/zero of=/dev/sda bs=4M
18806+0 records in
18806+0 records out
78878081024 bytes (79 GB, 73 GiB) copied, 194.874 s, 405 MB/s
19826+1 records in
19826+1 records out
83158360064 bytes (83 GB, 77 GiB) copied, 205.777 s, 404 MB/s
28373+1 records in
28373+1 records out
119007076352 bytes (119 GB, 111 GiB) copied, 297.393 s, 400 MB/s
63167+2 records in
63167+2 records out
264945287168 bytes (265 GB, 247 GiB) copied, 676.438 s, 392 MB/s
86331+2 records in
86331+2 records out
362102145024 bytes (362 GB, 337 GiB) copied, 929.764 s, 389 MB/s
dd: error writing '/dev/sda': No space left on device
122096+2 records in
122095+2 records out
512110190592 bytes (512 GB, 477 GiB) copied, 1320.58 s, 388 MB/s

real    22m0.588s
user    0m0.407s
sys     8m46.578s




Categories: Linux
Tags:
Author: Elmar Klausmeier