From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacob Broido Subject: Re: Fwd: cow snapshot on cloop device Date: Fri, 26 Aug 2005 03:51:16 +0200 Message-ID: <6262291505082518517c9d1adb@mail.gmail.com> References: <6262291505082404352d0a4dc2@mail.gmail.com> <6262291505082410002ca214a9@mail.gmail.com> <6262291505082410015647272d@mail.gmail.com> <200508251902.39765.kevcorry@us.ibm.com> Reply-To: device-mapper development Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1735568122==" Return-path: In-Reply-To: <200508251902.39765.kevcorry@us.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Kevin Corry Cc: dm-devel@redhat.com List-Id: dm-devel.ids --===============1735568122== Content-Type: multipart/alternative; boundary="----=_Part_2110_12103172.1125021076618" ------=_Part_2110_12103172.1125021076618 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hey Kevin, Thanks for the response, I've read through the thread but I am not clear on a few issues, Why is there a need to create a snapshot-origin, isnt the fact that I creat= e=20 snapshot of a specific device, in my case root_master, using the command := =20 echo "0 4096128 snapshot root_master /dev/loop0 p 8"| dmsetup create=20 root_cow0=20 already monitors the origin device root_master for write operations? As far as I understood the COW/snapshot logic is the following: 1) Snapshot device is created over some other dm device 2) snapshot dm device is mounted. 3) Any call to write() or othere rw syscalls issues a write to backing stor= e=20 as defined during creation of snapshot device, and relevant pointers=20 updated. 4) Read from mounted snapshot device, results in one of the following : if= =20 data was modified since the snapshot its read from COW backing=20 device(transparently to end user) , if data was not modified from snapshot= =20 creation, its read from origin dm device. In addition as I mentioned, I am able to mount the dm snapshot device, and = I=20 am also able to perform write operations (even though the origin device is= =20 on a readonly media). The problem I encountered is data corruption and is partial, all files are= =20 partially damaged or have corrupted parts. What am I missing? P.S Is there a documentation reagrding varios targets and their table forma= t P.P.S in snapshot creation, what does mean. Thanks. On 8/26/05, Kevin Corry wrote: >=20 > Hi Jacob, >=20 > On Wed August 24 2005 12:01 pm, Jacob Broido wrote: > > ---------- Forwarded message ---------- > > From: Jacob Broido > > Date: Aug 24, 2005 7:00 PM > > Subject: Re: [dm-devel] cow snapshot on cloop device > > To: Kevin Corry > > > > I am using dmsetup directly. and I do the following: > > 1) Create an empty file that will be used as cow backing storage > > 2) losetup the backing file to /dev/loop0 > > 3) create a snapshot of main root_device on /dev/loop0 > > 4) mount the cow snapshot > > > > > > Here is the info you requested: > > The kernel is a - 2.6.11.10 + xen= =20 > patch. > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D > > / # dmsetup ls > > root_master (253, 0) > > root_cow0 (253, 1) > > / # dmsetup table > > root_master: 0 4096128 linear 240:0 0 > > root_cow0: 0 4096128 snapshot 253:0 7:0 P 8 >=20 > Ok, this is not going to do what you're expecting it to do. In order to= =20 > use > snapshotting, you need a snapshot device, and you also need a=20 > snapshot-origin > device. The snapshot-origin code is what monitors the I/O path for the=20 > origin > device, and performs the copy-on-writes as necessary. >=20 > Last summer I did a write-up how you might use dmsetup to create=20 > snapshots. > You can read the thread at: > https://www.redhat.com/archives/dm-devel/2004-July/msg00068.html >=20 > But in short, it's vastly simpler to just use LVM2 or EVMS to create > snapshots. You should be able to create volumes on your cloop devices=20 > using > either set of tools. >=20 > Let me know if you have additional questions after reading through the=20 > thread > above. >=20 > -- > Kevin Corry > kevcorry@us.ibm.com > http://www.ibm.com/linux/ > http://evms.sourceforge.net/ >=20 --=20 Not gonna be king of the world if you're slave to the grind - Skid Row ------=_Part_2110_12103172.1125021076618 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hey Kevin,
Thanks for the response,

I've read through the thread but I am not clear on a few issues,

 Why is there a need to create a snapshot-origin, isnt the fact that I create snapshot of a specific device, in my case root_master, using the command :
echo "0 4096128 snapshot  root_master /dev/loop= 0 p 8"| dmsetup create root_cow0
already monitors the origin device root_master for write operations?

As far as I understood the COW/snapshot logic is the following:
1) Snapshot device is created over some other dm device
2) snapshot dm device is mounted.
3) Any call to write() or othere rw syscalls issues a write to backing store as defined during creation of snapshot device, and relevant pointers updated.
4) Read from mounted snapshot device, results in one of the following : if data was modified since the snapshot its read from COW backing device(transparently to end user) , if data was not modified from snapshot creation, its read from origin dm device.


In addition as I mentioned, I am able to mount the dm snapshot device, and I am also able to perform write operations (even though the origin device is on a readonly media).

The problem I encountered is data corruption and is partial, all files are = partially damaged or have corrupted parts.

What am I missing?

P.S Is there a documentation reagrding varios targets and their tabl= e format
P.P.S in snapshot creation, what does <p|n> mean.
Thanks.


On 8/26/05, Kevin Corry <kevcorry@us.= ibm.com> wrote:
Hi Jacob,

On Wed August 24 2005 12:01 pm, Jacob Broido wrote:
>= ; ---------- Forwarded message ----------
> From: Jacob Broido <jacob.broido@gmail.com>
> Date: Aug 24, 2005 7:00 PM
> Subject: Re: [dm-devel] cow snapsho= t on cloop device
> To: Kevin Corry <kevcorry@us.ibm.com>
>
> I am using dmsetup di= rectly. and I do the following:
> 1) Create an empty file that will be used as cow backing storage> 2) losetup the backing file to /dev/loop0
> 3) create a snapsh= ot of main root_device on /dev/loop0
> 4) mount the cow snapshot
>
>
> Here is the info you requested:
> The kernel is = a - 2.6.11.10 <http://2.6.11.10> + xen patch.
> =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> / # dmsetup ls
> root_master (253, 0)
> root_cow0 (253= , 1)
> / # dmsetup table
> root_master: 0 4096128 linear 240:0 = 0
> root_cow0: 0 4096128 snapshot 253:0 7:0 P 8

Ok, this is no= t going to do what you're expecting it to do. In order to use
snapshotting, you need a snapshot device, and you also need a snapshot-= origin
device. The snapshot-origin code is what monitors the I/O path fo= r the origin
device, and performs the copy-on-writes as necessary.

Last summer I did a write-up how you might use dmsetup to create snapsh= ots.
You can read the thread at:
https://www.redhat.com/archives/dm= -devel/2004-July/msg00068.html

But in short, it's vastly simpler to just use LVM2 or EVMS to c= reate
snapshots. You should be able to create volumes on your cloop devi= ces using
either set of tools.

Let me know if you have additional= questions after reading through the thread
above.

--
Kevin Corry
kevcorry@us.ibm.com
http://= www.ibm.com/linux/
http://e= vms.sourceforge.net/



--
Not gonna be ki= ng of the world if you're slave to the grind
- Skid Row ------=_Part_2110_12103172.1125021076618-- --===============1735568122== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============1735568122==--