Writing over a drive using /dev/zero

Colin McGregor colin.mc151-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Nov 29 17:02:59 UTC 2010


On Mon, Nov 29, 2010 at 11:55 AM, Daniel Wayne Armstrong
<daniel-HRJVlgn2G/y5aS82P/H3Zg at public.gmane.org> 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!

Another thought, cache. The drive (and/or the driver) might report
back that it had written the 1 GB file even if the physical writing
was not yet complete.

> --
> 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
>
--
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