title: testing sequential disk write performance with fio and iostat
body: <p>I am trying to make sense of sequential disk write performance on a spinning hard disk. I am using direct and sync io to bypass the page cache. For small block size (4KB) fio reports an iops of ~11. So this means fio is issuing 11 <code>write</code> system calls, each of 4k size (so total bandwidth = 11*4k = 44kb/s). But when I monitor the disk using iostat, it tells me that the disk is seeing ~60iops (w/s), with average request size of 4k (wareq-sz), for a total bandwidth of 60*4k ~ 240kb/s (wkB/s). So my questions are the following</p>
  <ol>
  <li><p>Why is my throughput so low even when doing sequential writes? (small block size should not really matter because the disk head should not move around much)</p>
  </li>
  <li><p>Who is causing the 3x write amplification which is seen in iostat.</p>
  </li>
  </ol>
  <p>I am enclosing the fio jobs file as well as iostat output</p>
  <p>jobs file</p>
  <pre><code>[global]
  filename=/mnt/500gbhdd/fio_file
  runtime=30s
  ioengine=sync
  time_based
  direct=1 
  sync=1 
  rw=write
  size=5G
  wait_for_previous
  
  
  [4k]
  bs=4k
  
  </code></pre>
  <p><a href="https://i.stack.imgur.com/fSPXc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fSPXc.png" alt="iostat output" /></a></p>