<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">As you might know, LVM2 actually uses a kernel component called devicemapper (DM).<DIV><BR class="khtml-block-placeholder"></DIV><DIV>DM has various targets that are used to create LVM devices.  For example, a simple LV might generate a table in DM like this:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>0 100000 linear 8:1 540</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This table maps reads on the LVM device from blocks 0 to 100000 (512 bytes each) to blocks on device 8:1 (sda1) starting at block 540.  As you might imagine, this system is very flexible and allows LVM2 to run entirely in userspace, with DM doing all of the heavy lifting in the kernel.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The secret sauce required to do snapshots requires help from LVM.  Notice that in the above table, the single entry has a target called "linear".  This is a simple mapping, nothing more.  Snapshots require the ability to intercept writes to the original LVM device in order to preserve the original data in the snapshot.  Thus, a snapshot creates the original LV's mapping, then creates an entry that uses the LV but has a "snapshot-origin" target (instead of merely a linear target) for the entire other volume.  For the cow volume it uses a "snapshot" target.  With these tools it creates the devices you actually use, including the extra volume (which is used to get that snapshot target in the loop).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>For a discussion of the underlying technology, look here:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><A href="http://www.mjmwired.net/kernel/Documentation/device-mapper/snapshot.txt">http://www.mjmwired.net/kernel/Documentation/device-mapper/snapshot.txt</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><DIV><DIV>On Mar 5, 2007, at 4:52 AM, Nallammai S wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I am new to lvm2. I am looking at the lvm2 code primarily to understand how snapshots are taken. When I debugged, i found that in addition to the COW LV, a LV named 'snapshot0' is also created. Why is this LV created?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks in advance</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Nallammai.S<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">linux-lvm mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:linux-lvm@redhat.com">linux-lvm@redhat.com</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="https://www.redhat.com/mailman/listinfo/linux-lvm">https://www.redhat.com/mailman/listinfo/linux-lvm</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">read the LVM HOW-TO at <A href="http://tldp.org/HOWTO/LVM-HOWTO/">http://tldp.org/HOWTO/LVM-HOWTO/</A></DIV> </BLOCKQUOTE></DIV></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>Jayson Vantuyl</DIV><DIV><FONT class="Apple-style-span" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"><SPAN class="Apple-style-span" style="font-size: 10px; "><SPAN class="Apple-style-span" style="font-size: 10px; ">Systems Architect</SPAN></SPAN></SPAN></FONT></DIV><DIV><B style="font-weight: bold; "><A href="http://www.engineyard.com"><SPAN class="Apple-style-span" style="font-weight: normal;; color: rgb(0, 0, 238); -khtml-text-decorations-in-effect: underline; "><SPAN class="Apple-style-span" style="color: rgb(0, 0, 238); -khtml-text-decorations-in-effect: underline; ">Engine Yard</SPAN></SPAN></A></B></DIV><DIV><FONT class="Apple-style-span" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"><SPAN class="Apple-style-span" style="font-size: 10px; "><SPAN class="Apple-style-span" style="font-size: 10px; "><A href="mailto:jvantuyl@engineyard.com">jvantuyl@engineyard.com</A></SPAN></SPAN></SPAN></FONT></DIV></SPAN><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR></BODY></HTML>