[linux-lvm] why LVM reads when I tell it to write?

Larry Dickson ldickson at cuttedge.com
Mon Mar 23 21:23:38 UTC 2009


Hello Tomasz,

An experiment with dd to a plain file indicates its default block size is
512 bytes. Given that, the most common cause of reads when writing is that
LVM may insist on writing aligned full pages or chunks. This would force
read-modify-writes if it's not smart enough to preview enough commands to
see it's going to overwrite the whole chunk. That would be solved if the
block size is a multiple of chunk size (assuming of course that it is
aligned).

Larry Dickson
Cutting Edge Networked Storage

On 3/23/09, Tomasz Chmielewski <mangoo at wpkg.org> wrote:
>
> Why is LVM reading large amounts of data when I tell it to write only?
>
>
> For example, this is what iostat shows when writing to a raw partition
> (when doing "dd if=/dev/zero of=/dev/sdb5", iostat output every second):
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb              80.81         0.00      5171.72          0       5120
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb              78.00         0.00      4992.00          0       4992
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb              81.82         0.00      5236.36          0       5184
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb              77.00         0.00      4928.00          0       4928
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb              79.21         0.00      5069.31          0       5120
>
>
> This is what happens if we go through LVM - look how much is read before it
> actually writes anything:
>
> (when doing "dd if=/dev/zero of=/dev/test/test_volume").
>
> What's interesting, if I add i.e. bs=64k to dd, I don't see these
> unexpected
> reads on LVM any more. Why does it happen?
>
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             212.87       851.49         0.00        860          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             956.57      3826.26         0.00       3788          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1083.84      4335.35         0.00       4292          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1016.00      4064.00         0.00       4064          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1035.64      4142.57         0.00       4184          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1034.00      4136.00         0.00       4136          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             965.66      3862.63         0.00       3824          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1025.00      4100.00         0.00       4100          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             991.92      3967.68         0.00       3928          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1032.00      4128.00         0.00       4128          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1009.90      4039.60         0.00       4080          0
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             366.33      1330.61      4040.82       1304       3960
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb            1016.16      4060.61        76.77       4020         76
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             383.17      1394.06      4055.45       1408       4096
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             741.00      2904.00      1800.00       2904       1800
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             638.61      2475.25      2273.27       2500       2296
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             421.00      1560.00      3720.00       1560       3720
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             955.56      3802.02       501.01       3764        496
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             275.76       965.66      4016.16        956       3976
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             853.00      3384.00       840.00       3384        840
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             560.40      2130.69      3223.76       2152       3256
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             500.00      1907.07      2787.88       1888       2760
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             133.00       352.00      5296.00        352       5296
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb              53.00         0.00      6244.00          0       6244
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb             267.00       904.00      4840.00        904       4840
>
> Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
> sdb              52.00         0.00      6240.00          0       6240
>
>
>
> --
> Tomasz Chmielewski
> http://wpkg.org
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20090323/b94c327a/attachment.htm>


More information about the linux-lvm mailing list