[linux-lvm] COW store

Greg Freemyer greg.freemyer at gmail.com
Mon Jul 19 21:12:25 UTC 2010

On Mon, Jul 19, 2010 at 3:06 PM, andiket a <truly_linux at yahoo.co.in> wrote:
> Greg,
> You got absolutely right.
> That is exactly what I actually wanted to ask.
> I didn't know about this pv stuff for original LVs n snapshot LVs.
> Let me look at the lvcreate once again.
> I want the cow store to go on to a separate physical device.

You can create new LVs on the PVs you want by simply adding a PV param
at the end of the lvcreate line.  (See the man page).

But assuming you already have LVs created:

Use "lvdisplay -m" to show you which PVs your current LVs are on.

Assuming the LVs are not on the PVs you want them to be on, then you
can use pvmove to move the LV extents off of one PV and onto another.
I believe that can be done without disabling the LV, but I don't
recall testing it.

In my case I have 2 PVs:

PV /dev/sdb1 is for my main data and PV /dev/sda3 is for my snapshots.

If I just want to move all the LV extents off a PV so you can dedicate
it to snapshots, you can simply:

pvmove /dev/sda3               where /dev/sda3  would be the PV I'm
trying to free up.

So when setting things up I could have done "pvmove /dev/sda3" to
ensure my PV wasn't used for normal LVs.

Then one of my nightly scripts has this in it:

lvcreate --snapshot -L 45g --name data_snap /dev/TruStore-Data/data /dev/sda3

I believe that says "create a 45GB snapshot named data_snap of the
main LV on the PV /dev/sda3".  (I set that up years ago, and I admit
to not testing it recently.)

And since I setup /dev/TruStore-Data/data to be on /dev/sdb1, I know
the main LV and snapshot LV are on different PVs.

Again, at any point I can run "lvdisplay -m" to double check things
are the way I want them.

Hope that helps

More information about the linux-lvm mailing list