aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2005-09-23 00:44:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-23 01:17:37 -0400
commite484585ec3ee66cd07a627d3a9e2364640a3807f (patch)
tree38d0cd1f7b1699b4a14ea77b77b9c0f5a87197cc /Documentation
parent10d2c46f9408d404bffef89d5052953a3b1d9288 (diff)
[PATCH] Add dm-snapshot tutorial in Documentation
I've recently discovered the real functionality of device-mapper snapshots, and since they are not well known, I've decided to write some docs for them. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/device-mapper/snapshot.txt73
1 files changed, 73 insertions, 0 deletions
diff --git a/Documentation/device-mapper/snapshot.txt b/Documentation/device-mapper/snapshot.txt
new file mode 100644
index 000000000000..dca274ff4005
--- /dev/null
+++ b/Documentation/device-mapper/snapshot.txt
@@ -0,0 +1,73 @@
1Device-mapper snapshot support
2==============================
3
4Device-mapper allows you, without massive data copying:
5
6*) To create snapshots of any block device i.e. mountable, saved states of
7the block device which are also writable without interfering with the
8original content;
9*) To create device "forks", i.e. multiple different versions of the
10same data stream.
11
12
13In both cases, dm copies only the chunks of data that get changed and
14uses a separate copy-on-write (COW) block device for storage.
15
16
17There are two dm targets available: snapshot and snapshot-origin.
18
19*) snapshot-origin <origin>
20
21which will normally have one or more snapshots based on it.
22You must create the snapshot-origin device before you can create snapshots.
23Reads will be mapped directly to the backing device. For each write, the
24original data will be saved in the <COW device> of each snapshot to keep
25its visible content unchanged, at least until the <COW device> fills up.
26
27
28*) snapshot <origin> <COW device> <persistent?> <chunksize>
29
30A snapshot is created of the <origin> block device. Changed chunks of
31<chunksize> sectors will be stored on the <COW device>. Writes will
32only go to the <COW device>. Reads will come from the <COW device> or
33from <origin> for unchanged data. <COW device> will often be
34smaller than the origin and if it fills up the snapshot will become
35useless and be disabled, returning errors. So it is important to monitor
36the amount of free space and expand the <COW device> before it fills up.
37
38<persistent?> is P (Persistent) or N (Not persistent - will not survive
39after reboot).
40
41
42How this is used by LVM2
43========================
44When you create the first LVM2 snapshot of a volume, four dm devices are used:
45
461) a device containing the original mapping table of the source volume;
472) a device used as the <COW device>;
483) a "snapshot" device, combining #1 and #2, which is the visible snapshot
49 volume;
504) the "original" volume (which uses the device number used by the original
51 source volume), whose table is replaced by a "snapshot-origin" mapping
52 from device #1.
53
54A fixed naming scheme is used, so with the following commands:
55
56lvcreate -L 1G -n base volumeGroup
57lvcreate -L 100M --snapshot -n snap volumeGroup/base
58
59we'll have this situation (with volumes in above order):
60
61# dmsetup table|grep volumeGroup
62
63volumeGroup-base-real: 0 2097152 linear 8:19 384
64volumeGroup-snap-cow: 0 204800 linear 8:19 2097536
65volumeGroup-snap: 0 2097152 snapshot 254:11 254:12 P 16
66volumeGroup-base: 0 2097152 snapshot-origin 254:11
67
68# ls -lL /dev/mapper/volumeGroup-*
69brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real
70brw------- 1 root root 254, 12 29 ago 18:15 /dev/mapper/volumeGroup-snap-cow
71brw------- 1 root root 254, 13 29 ago 18:15 /dev/mapper/volumeGroup-snap
72brw------- 1 root root 254, 10 29 ago 18:14 /dev/mapper/volumeGroup-base
73