[linux-lvm] Snapshots and disk re-use

Jonathan Tripathy jonnyt at abpni.co.uk
Wed Apr 6 01:45:14 UTC 2011



On 06/04/2011 02:20, James Hawtin wrote:
> On 06/04/2011 00:50, Jonathan Tripathy wrote:
>>
>> 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...
>
> What would happen is... if the file systems are mounted at boot time 
> (in  the fstab) it will fail the fsck because the device is not there. 
> and drop to single user mode, you could then edit the fstab to to 
> remove those file systems that would bring the system online, at which 
> point you could fix what stopped the iscsi from working, and mount the 
> file systems.
>
> At one place I worked they never mounted the data file systems at 
> "boot" but in a rc.local so the system always got to be interactive 
> before any problems so it was easy to go in and fix.
Since my vg is used purly for virtualisation, I don't mount any LVs in 
fstab in my host OS. LVs only get mounted once VMs start up.
>
> DO NOT... create a loop back device on the same on a file system that 
> the loopback that will then form a pv of, if you do your system is 
> DOOOMMMED! to get it to boot again your have to mount a part volume 
> group and block copy the devices to a new one, even worse if you 
> extended the file system with the loop back on it onto the pv of the 
> loop back it will NEVER work again. So the only place you can create a 
> loopback device is outside of a vg it is to be a part of and frankley 
> better that its in NO vg as you may get recursion problems.
Oh no, wouldn't dare to do that :) I was thinking of creating the image 
file on a non-LVM area of the drive (somewhere in the host OS partition)
>
> The problem with a loop back is that you need to do a the loopback 
> setup to enable the device before the vgscan and vgchange can bring it 
> online in the volume, very hard to get right at boot time.  If you 
> have partitioned it you will also need to do kpartx.
Well I wouldn't partition the image file, seems more trouble than it's 
worth. I did find an article from Novell that seems to guide me through 
what to do if my machine were to reboot with a PV missing:

http://www.novell.com/coolsolutions/appnote/19386.html

>
> If you use loopbacks i  would extend the volume group onto the disk 
> only during backups then nreduce it out afterwards to reduce risks.
Good Idea.




More information about the linux-lvm mailing list