[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] Snapshot and sparse device


I am confused by how snapshotting works in dm; I base this discussion on vanilla
kernel 2.6.8. Documentation/device-mapper/zero.txt claims that if I do
  echo "0 21474836480 zero" | dmsetup create zero1
  echo "0 21474836480 snapshot /dev/mapper/zero1 /dev/sdb1 p 128" | \
     dmsetup create sparse1
and /dev/sdb1 is a 10GB partition then /dev/mapper/sparse1 will be a sparse
device with 10TB declared space back by a 10GB actual storage room. I
understand that this means that I can write up to 10GB of real data anywhere in
the 0..10TB sector range, while accesses outside of already-written data will
read zeros.

However reading from Kevin Corry presentation
http://evms.sourceforge.net/presentations/evms-utexas-lecture-2003.pdf , slide
23 I read that snapshotting performs copy-on-write. Thus if I attempt to write
from /dev/mapper/sparse1 the old data (actually a chunk of zeros) will be
written to /dev/sdb1 while my new data will be written to /dev/mapper/zero1
(which will actually discard it, see drivers/md/dm-zero.c:56-58).

This is not the expected behaviour, is it ? I believe I am confused by what the
snapshot and the snapshot-origin targets are for, and would appreciate if you
could point me to the relevant documentation on them.

 Thanks in advance,
 Guillaume Lacôte.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]