[linux-lvm] read-only snapshots and data corruption
truly_linux at yahoo.co.in
Thu Apr 22 05:10:09 UTC 2010
I am trying to a read-only snapshot using lvcreate. After I mount the snapshot volume I see a data corruption.
The test case is described below:
1. Create a volume using lvcreate of size 1G and format this volume with ext3 filesystem.
lvcreate --size 1G -n my_lv my_vg
2. Mount the volume to a folder /mnt/temp and create a file try.txt on the volume. Dump random data inside this file (try.txt) of size around 50K (size of data is immaterial still preferably keep it well over a few tens of kbs).
mount /dev/my_vg/my_lg /mnt/temp
3. Take a snapshot.
lvcreate --snapshot --size 100M -c 16 -n my_snap -p r /dev/my_vg/my_lv
4. Now modify the file /mnt/temp/try.txt (on original volume).
5. Take second snapshot.
lvcreate --snapshot --size 100M -c 16 -n my_snap2 -p r /dev/my_vg/my_lv
6. Again modify the file /mnt/temp/try.txt (on original volume).
75. Take third snapshot.
lvcreate --snapshot --size 100M -c 16 -n my_snap3 -p r /dev/my_vg/my_lv
8. Mount all of the snapshots and check contents of the file try.txt in each of the snpashots.
The data in snapshots is most of the time of incosistent or doesn't match at all with the data expected in the snapshot volume. Conent of the entire file is different though size of the file remains exactly what it should be.
After a couple of debugging sessiosn I figured out that when I am trying to the snapshot device, it is reading data always from the cowstore. This is true even when reading data from sectors/blocks which were not modified after taking snapshots.
NOTE: This works perfectly fine with read-write snapshots.
Is this a know issue with lvm2 readonly snapshots?
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the linux-lvm