[linux-lvm] Snapshots and disk re-use

James Hawtin oolon at ankh.org
Wed Apr 6 01:20:57 UTC 2011


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.

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.

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.

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

Steal space from somewhere you say you have the OS on a physical 
paritions, so LVM everything but / and /boot redo the make a pv on the 
space freed. to rescue a system is easy if you can mount / everything 
else does not matter.

If you have everything in / ... you are insane as you should set /var, 
/tmp and perhaps even /home to noexec as if you get an automated break 
in that is normally where the write stage two, to get executed, this 
normally stops them in there tracks, No public writiable filesystems 
should be executable.... !

James




More information about the linux-lvm mailing list