All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Brian J. Murrell" <brian@interlinx.bc.ca>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] balooning/dynamic snapshots?
Date: Tue, 13 Nov 2007 15:27:21 -0500	[thread overview]
Message-ID: <1194985641.24880.11.camel@pc.ilinx> (raw)
In-Reply-To: <4739DB30.9060805@wpkg.org>

On Tue, 2007-11-13 at 18:13 +0100, Tomasz Chmielewski wrote:
> 
> Is it possible to make a "balooning", or dynamic LVM snapshot? That is, 
> if the snapshot reaches its maximum, it will be automatically resized, 
> provided we still have space on the medium.

Yeah, that is something I wanted at one time.  In it's absence, I hacked
up the following brute-force solution.  I don't like the concept, but it
works.

        #!/usr/bin/ruby
        
        threshold=80.0
        increase_factor=0.5
        
        IO.popen("/testsuite/ltest-boulder/acceptance/common/timed_run 10 /usr/sbin/lvs") do |f|
          f.each_line do |line|
            j,volume,j,j,size,j,used = line.chomp.split(/\s+/)
            if used.to_f > threshold then
              # by bytes
              #size = eval(size.sub(/G$/, ' * 1024 * 1024 * 1024'))
              re = /([\d\.]+)([GM])/
              md = re.match(size)
              size = md[1]
              units = md[2]
              expand_by = size.to_f * increase_factor
              system("echo \"lv #{volume} was #{size}#{units} big and #{used} full and was expaned +#{expand_by}#{units}\" | mail -s \"snap expanded\" root")
              system("/testsuite/ltest-boulder/acceptance/common/timed_run 60 /usr/sbin/lvextend -L+#{expand_by}#{units} /dev/vg0/#{volume}")
            end
          end
        end

Put it in cron and run at an appropriate frequency.

b.

  reply	other threads:[~2007-11-13 20:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-13 17:13 [linux-lvm] balooning/dynamic snapshots? Tomasz Chmielewski
2007-11-13 20:27 ` Brian J. Murrell [this message]
2007-11-13 20:29   ` Brian J. Murrell
2007-11-26  5:12   ` [linux-lvm] lvm library progress? ben scott
2007-11-26 15:22     ` Greg_Swift

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1194985641.24880.11.camel@pc.ilinx \
    --to=brian@interlinx.bc.ca \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.