All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: Snapshots
Date: Tue, 18 Dec 2007 17:38:27 -0500	[thread overview]
Message-ID: <47684BE3.5060408@ce.jp.nec.com> (raw)
In-Reply-To: <47682630.5060803@cfl.rr.com>

Phillip Susi wrote:
> I have been playing around with the snapshot target with dmsetup, and I
> can set up a snapshot that diverts writes to a backing file, so that
> modifications to the snapshot device are discarded when I remove the
> snapshot device and go back to using the origin device.  What I can't
> figure out is how to keep the origin device mounted and have the
> snapshot device appear to contain the origin's data at the time it was
> created, even though the origin continues to be modified.
> 
> I thought one of the main ideas of the snapshot was to be able to backup
> a consistent filesystem image even though the filesystem continues to be
> written to, but it seems that having the origin device mounted gets an
> exclusive lock on it so that the snapshot device can not be targeted at
> it, so how do you do this?

LVM2 does it by putting a linear mapping on top of the origin device.

I'm not sure if this meets your requirement, but something like this:

1. Put a linear mapping on the origin
   (/dev/sdb2 is origin in this example)

# echo "0 $(blockdev --getsz /dev/sdb2) linear /dev/sdb2 0" | dmsetup create sdb2

2. Use the device as you like..

# mkfs.ext3 /dev/mapper/sdb2
# mount /dev/mapper/sdb2 /mnt/1
..

3. Insert a snapshot-origin map *below* the dm-linear

# dmsetup suspend sdb2
# echo $(dmsetup table sdb2) | dmsetup create sdb2-origin
# echo "0 $(blockdev --getsz /dev/mapper/sdb2-origin) snapshot-origin /dev/mapper/sdb2-origin" | dmsetup load sdb2
# dmsetup resume sdb2

4. Create any number of snapshots for the origin map

# echo "0 $(blockdev --getsz /dev/mapper/sdb2) snapshot /dev/mapper/sdb2-origin /dev/sdc2 P 8 " | dmsetup create
sdb2-snapshot
# dmsetup ls --tree
sdb2 (253:19)
 `-sdb2-origin (253:21)
    `- (8:18)
sdb2-snapshot1 (253:20)
 |- (8:34)
 `-sdb2-origin (253:21)
    `- (8:18)
# dmsetup table | grep sdb
sdb2: 0 15615180 linear 253:21 0
sdb2-snapshot1: 0 15615180 snapshot 253:21 8:34 P 8
sdb2-origin: 0 15615180 linear 8:18 0

If dm can insert a mapping *below* the device, you can do
without the dm-linear layer. But there's no such feature yet.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America

  reply	other threads:[~2007-12-18 22:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-18 19:57 Snapshots Phillip Susi
2007-12-18 22:38 ` Jun'ichi Nomura [this message]
2007-12-19 16:42   ` Snapshots Phillip Susi
2007-12-19 20:59     ` Snapshots Jun'ichi Nomura
2007-12-20 19:45       ` Snapshots Phillip Susi
2007-12-22  1:28         ` Snapshots Jun'ichi Nomura
  -- strict thread matches above, loose matches on Subject: below --
2017-09-15 17:28 snapshots Two Spirit
2017-09-15 17:37 ` snapshots Sage Weil
2017-09-15 17:42   ` snapshots Two Spirit
2017-09-15 18:25     ` snapshots Sage Weil
2017-09-15 18:59       ` snapshots Eric Eastman
2017-09-15 19:33         ` snapshots Wyllys Ingersoll
2017-09-15 20:22           ` snapshots Sage Weil
2017-09-15 21:23             ` snapshots Wyllys Ingersoll

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47684BE3.5060408@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.