[linux-lvm] Keep snapshots active for 24 hours?

Andreas Dilger adilger at turbolabs.com
Sat Dec 15 00:31:02 UTC 2001


On Dec 15, 2001  02:00 +0100, Terje Kvernes wrote:
> * Andreas Dilger
> > If you were really clever, you could write a script which checked
> > the free space in the snapshots every minute, and if they had less
> > than X PEs free, you extend the snapshot LV to have more free space.
> > If you run out of free PEs, you delete the oldest snapshot.
> 
>   heh. I was thinking of trying to get a snapshot taken every three
>   hours or so, and storing it until the next one came about. but of
>   course, you're right, I should check how much free space I have, and
>   keep a backlog until I _need_ the space. 
> 
>   come to think of it, it doesn't take that complicated a shell-script
>   to get this working. hm... :)

In fact, the LVM snapshots have a facility where you can have it wake a
process when the snapshot is more than X percent full.  You probably
couldn't do it with a shell script (it is an ioctl), but you could
either write a simple executable (e.g. lvmsnapwait 95 /dev/vgtest/lvtest),
or do it with Perl (there is a Perl ioctl module, whose name I have
forgotten).

This avoids polling for lots of snapshots of lots of LVs, and also prevents
you from over-committing PEs to snapshots.

Note that there is a system-wide hard limit of 255 LVs (ABS_MAX_LV).  The
problem is that LVM only has a single block major number, with 256 minor
numers, so you might have to do some kernel/tool hackery to exceed that.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/





More information about the linux-lvm mailing list