[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] Snapshots and disk re-use



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. 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.

BTW new use pvmove on /var as it stores data there and will freeze the whole system.

All hope is not lost, if you can add disk temperately you can use :-
1) add a new pv to the exisiting disk (vgextend)
2) move the data lvs to the new pv (pvmove)
3) remove the old disk (vgreduce)
  a) check with pvscan that the old disk really is not in use
4) resize the partiton (fdisk)
5) create a new pv (pvcreate --force) you need that to overwrite... take care now.
6) add the old disk back in (vgextend)
7) move the data lvs back to the old disk (pvmove)
8) remove the temp disk (vgreduce)

Now that is worth cake!

James


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]