[linux-lvm] Snapshots and disk re-use
Jonathan Tripathy
jonnyt at abpni.co.uk
Wed Apr 6 00:50:35 UTC 2011
On 06/04/2011 01:42, James Hawtin wrote:
> On 06/04/2011 00:28, Jonathan Tripathy wrote:
>> Ok, i think I get it now. At the minute, my vg (vg0) only has on PV
>> in it (/dev/md3 which you can tell is a mdadm RAID device). I wasn't
>> aware you could add more PVs (that's pretty cool!). So, let's say I
>> had a spare partition (/dev/hdb7 as an example). To my vg0 volume
>> group, I would firstly:
>>
>> pvcreate /dev/hdb7
>> vgextend /dev/hdb7
>
> Right however danger warnings are going off in my mind now!
>
>> Then, every time I create a new customer LV, I would do:
>>
>> lvcreate -nNewCustomerLV -L20G vg0 /dev/md3
>
> yes that would work
>
>>
>> Then, every time I wanted to create a snapshot:
>>
>> lvcreate -L20G -s -n data_snap /dev/vg0/NewCustomerLV /dev/hdb7
>>
>
> Yes
>
>> Is that correct? No Leakage? And no zeroing needed?
> Indeed
>
>>
>> Side note: Since I didn't partition my servers with this in mind, my
>> new PV will probably have to be an iSCSI device located on a remote
>> target :( Either that or use a loopback device with an image, but I'd
>> be scared that the system would not boot properly. Can you give me
>> any tips on how to use an image file as a PV just for snapshots?
>
> Ok, there has been alot of dangerous talk here, i assume you are using
> an md device so you can mirror things.
Correct
> If you added a single disk to that, and that disk failed you would
> have a major problem. Likewise if you rebooted with open snaps and
> iscsi you would need that iscsi device available during computer boot.
> I REALLY hope you do not have your local FS on the same vg as your
> data. As this would result in a non booting machine.
Nope. My root partition is not on LVM at all, but just on a regular md
partition. The LVM LVs are used for virtual machine hosting for
customers. Also, I used just /dev/hdb7 as an example, but it does bring
up some interesting questions:
If the PV used for snapshots were to fail while the snapshot was open,
or the server rebooted and the PV wasn't available at boot, what would
happen? I ask these questions because a loopback device or iSCSI is
really my only feasible option right now for the snapshot PV...
More information about the linux-lvm
mailing list