News for hackers. Stuff that matters.
Re:Linux shell tips and tricks by onosendai on Sunday November 24, 2013 @07:56AM (#6789492)
The quick 'n dirty recipe to test the disk write speed isn't ideal, since there's the buffer cache which significantly skews the results. A much better way would be:

> sync && time sh -c "dd if=/dev/zero of=foo bs=1M count=10000 && sync"

Then just divide 10000 (or whatever value you choose) by the number of seconds elapsed and you should get a much closer approximation of the sequential write speed, taking into account completely flushing the buffer to disk.

Re:Linux shell tips and tricks by emilw on Sunday November 24, 2013 @08:48AM (#6789592)
Even better would be to not use dd, it isn't intended for testing/benchmarking write speeds, and use http://www.iozone.org/
Re:Linux shell tips and tricks by onosendai on Sunday November 24, 2013 @09:18AM (#6789650)
This is a collection of quick shell recipes, so in that context it's perfectly acceptable. Besides, there are some environments where you can't just install packages willy-nilly, even if they're present on the repositories.
Re:Linux shell tips and tricks by ehsanu1 on Sunday November 24, 2013 @09:01AM (#6789619)
Re:Linux shell tips and tricks by vram22 on Sunday November 24, 2013 @02:14PM (#6790648)
I had read some time ago that sync doesn't actually flush the buffer cache, it just schedules it to be written (and that may happen a little later). Could be wrong though, or the information could be outdated in recent Linux versions (I read that about some UNIX version, IIRC).
Re:Linux shell tips and tricks by vram22 on Sunday November 24, 2013 @02:16PM (#6790660)
Edit: by "a little later", I meant: not necessarily synchronously. So the sync command may return before the buffer cache is actually flushed.