Skip to contentSkip to conversation

snapshotting to a different volume group

linux-lvm Stephane Chazelas 2 participants 5 messages Apr 17, 2008 – Apr 18, 2008

lore
Share & tools
lore
#0 lore raw

Hiya,

I hope you could help me on this:

in short:

is it possible to create a snapshot LV of an original LV but in a different volume group?

or alternatively, what's the best way to bring up a LV in a VG that is missing a PV (as in a disk crash) if that LV has all its extents on still sane PVs?

in long:

basically, this is what I would like to do:

I have two disks, not as much as I would like, and I want:
- to have 100GB of data mirrored (using Linux software raid (mdadm)) on 2 disks so that it survives disk crashs
- to make a number of frequent snapshots of that data to be able to restore things in case of human errors.
- (and I also want to have some "striped" storage space for worthless data).

BUT, I don't want to have the snapshot volumes mirrored.

My initial idea was to have 2 volume groups: a "safe" one with only one /dev/md0 PV and an "unsafe" one with the striped LVs and the snapshots.

However I couldn't find how to create snapshots of the LVs in "safe" into the "unsafe" VG. It seems to me that it should be possible, shouldn't it?

Anyway, then I merged the two "safe" and "unsafe" VGs into one "vol" VG. Now I can make snapshots of the LV physically located on /dev/md0 into the "unsafe" area.

But if one of the disks fails, /dev/md0 will still be available but the "vol" VG won't be able to come up because of the other missing PVs.

If such a thing happen, I can happily live with the missing snapshots and "unsafe" storage for a while until I buy a replacement HD, but how should I do about making sure that the /dev/md0 filesystem is still available in the mean time?

Or is there a more straightforward way to achieve this that I haven't thought of?

TIA,
Stephane

#1 lore raw
Quoted 9 lines · Stephane Chazelas

Hiya,

I hope you could help me on this:

in short:

is it possible to create a snapshot LV of an original LV but in a different volume group?

No, not with LVM.

Quoted 4 lines

or alternatively, what's the best way to bring up a LV in a VG that is missing a PV (as in a disk crash) if that LV has all its extents on still sane PVs?

vgchange -P -ay

If you have 2 disks, you better mirror them to be completely HA on the spindle side of things and avoid any such config hassle, potentially leaving you with lost data.

Heinz

Quoted 40 lines

in long:

basically, this is what I would like to do:

I have two disks, not as much as I would like, and I want:
- to have 100GB of data mirrored (using Linux software raid (mdadm)) on 2 disks so that it survives disk crashs
- to make a number of frequent snapshots of that data to be able to restore things in case of human errors.
- (and I also want to have some "striped" storage space for worthless data).

BUT, I don't want to have the snapshot volumes mirrored.

My initial idea was to have 2 volume groups: a "safe" one with only one /dev/md0 PV and an "unsafe" one with the striped LVs and the snapshots.

However I couldn't find how to create snapshots of the LVs in "safe" into the "unsafe" VG. It seems to me that it should be possible, shouldn't it?

Anyway, then I merged the two "safe" and "unsafe" VGs into one "vol" VG. Now I can make snapshots of the LV physically located on /dev/md0 into the "unsafe" area.

But if one of the disks fails, /dev/md0 will still be available but the "vol" VG won't be able to come up because of the other missing PVs.

If such a thing happen, I can happily live with the missing snapshots and "unsafe" storage for a while until I buy a replacement HD, but how should I do about making sure that the /dev/md0 filesystem is still available in the mean time?

Or is there a more straightforward way to achieve this that I haven't thought of?

Quoted 8 lines

TIA,
Stephane

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat GmbH
Consulting Development Engineer                   Am Sonnenhang 11
Storage Development                               56242 Marienrachdorf
                                                  Germany
[email protected]                            PHONE +49  171 7803392
                                                  FAX   +49 2626 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
2008-04-18 10:24:36 +0200, Heinz Mauelshagen:
Quoted 1 line · Stephane Chazelas

[...]

Quoted 4 lines
Quoted 2 lines

is it possible to create a snapshot LV of an original LV but in a different volume group?

No, not with LVM.

Hi Heinz,

thanks. I've just come accross zumastor while reading the ML archives. It looks promising for what I'm trying to achieve. I suspect it's gonna be the same wrt to snapshot though, but I'll give it a try.

Quoted 5 lines
Quoted 3 lines

or alternatively, what's the best way to bring up a LV in a VG that is missing a PV (as in a disk crash) if that LV has all its extents on still sane PVs?

vgchange -P -ay

Oh thanks. I missed that as the option was described in lvm(8) and not in vgchange(8). I'll see how to make it fit in the initrd scripts.

Quoted 3 lines

If you have 2 disks, you better mirror them to be completely HA on the spindle side of things and avoid any such config hassle, potentially leaving you with lost data.

[...]

I didn't get that ("the spindle side of things"??). Do you mean I should mirror the whole disks? Note that they are not the same size. The thing is I have 400 GB of disk space available, I only need 100GB of data to be "safe". If I had 2 200GB drives and wanted to mirror everything, and have 50GB for snapshots, that would leave me with 150 GB for data. While as I need only 100GB of safe data and don't need the snapshots to be mirrored. I can have 250 GB of storage, 150 GB of which I don't care if it's lost (mirrors and snapshots).

Best regards,
Stephane

#3 lore raw
In reply to Heinz Mauelshagen
2008-04-18 10:24:36 +0200, Heinz Mauelshagen:

[...]

Quoted 5 lines
Quoted 3 lines

or alternatively, what's the best way to bring up a LV in a VG that is missing a PV (as in a disk crash) if that LV has all its extents on still sane PVs?

vgchange -P -ay

[...]

I just tried that with loop devices. Unfortunately, the LV comes up in read-only. And lvdisplay doesn't show the still sane LVs.

dmsetup info shows it as read-only and lvdisplay -P as read/write, btw:

lvdisplay -P:

--- Logical volume ---
LV Name /dev/test/fs
VG Name test
LV UUID
U03Sgj-dVYW-TBSs-fJHN-qXbm-y3vf-nN58mV
LV Write Access read/write

dmsetup info:

Name:              test-fs
State:             ACTIVE (READ-ONLY)
Read Ahead:        256
Tables present:    LIVE
Open count:        1
Event number:      0

Major, minor: 253, 4
Number of targets: 1
UUID:
LVM-CL1U6NmSQ0QxvXkg8Iy4BEJE4kzEAJokU03SgjdVYWTBSsfJHNqXbmy3vfnN58mV

By bypassing LVM2 and using dmsetup directly, would I theoretically be able to setup a snapshot outside of LVM2 managed volume groups, is it worth me trying to dig that way? Something like: having a LVM (or not) volume group with only /dev/md0 and creating snapshots of that elsewhere while leaving the VG containing /dev/md0 undisturbed?

TIA,
Stephane

#4 lore raw
2008-04-18 12:53:15 +0100, Stephane Chazelas:

[...]

Quoted 6 lines

By bypassing LVM2 and using dmsetup directly, would I theoretically be able to setup a snapshot outside of LVM2 managed volume groups, is it worth me trying to dig that way? Something like: having a LVM (or not) volume group with only /dev/md0 and creating snapshots of that elsewhere while leaving the VG containing /dev/md0 undisturbed?

[...]

[replying to myself]

OK, I get it.

When one creates a snapshot, he changes the original block device to be a "snapshot-origin" so that every write to the device is forked into:
- copying the original block to the snapshot device(s) COW(s)
- writing to the original device.

So, if I've got the COWs on a failed disk, I suspect this might degrade the performances or even stop the snapshot-origin from working altogether wouldn't it?

I'll keep testing...

Signature · 1 line
Stephane