Writing over a drive using /dev/zero

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Nov 29 17:09:21 UTC 2010


On Mon, Nov 29, 2010 at 11:55:16AM -0500, Daniel Wayne Armstrong wrote:
> I wanted to estimate how much time it would take to write over a 1TB
> external hard drive connected by USB using "dd" and /dev/zero ... so I
> generated a sample 1GB file using:
> 
> touch zero_erase && /usr/bin/time -av -o zero_erase dd if=/dev/zero
> of=file1g_zero.tmp bs=1M count=1024
> 
> User time (seconds): 0.00
> System time (seconds): 0.93
> Percent of CPU this job got: 15%
> Elapsed (wall clock) time (h:mm:ss or m:ss): 0:06.06
> 
> Extrapolating from the sample I estimated it would take roughly 2
> hours to fill a 1TB drive. But the actual result was:
> 
> /usr/bin/time -av -o zero_erase dd if=/dev/zero of=/dev/sdb bs=1M
> 
> User time (seconds): 1.11
> System time (seconds): 889.01
> Percent of CPU this job got: 2%
> Elapsed (wall clock) time (h:mm:ss or m:ss): 10:09:45
> 
> Quite a difference. Two factors I think might account for it:
> 
> * test sample was created on the local disk ... external disk might be
> slower due to the USB connection?
> 
> * CPU usage is much lower writing to the external disk vs the sample
> file... would increasing the priority and CPU usage increase the speed
> of the dd command?
> 
> Any thoughts? Thanks!

Did you remember to sync to finish the write to disk as part of our
measurement?

For 1TB though, it probably becomes just noise in the end given how long
it already takes.

If it is USB2, then you can probably figure about 25MB/s, so 40 seconds
per GB, so 40000 seconds for a TB.  So about 11 or 12 hours.  Might do
it in 10 if you get lucky.  eSATA can probably do 80MB/s on a decent
1TB drive, so maybe 4 hours.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list