[mylvmbackup] snapshot size should be given in extents, not megabytes

Hello,

i am writing a wrapper around mylvmbackup that has it create the snapshot
using all available space in the volume group (among other things).
the problem here is that when passing the size in units of bytes, this is
subject to rounding errors:

db01:~# lvm vgdisplay VG | grep Free
  Free  PE / Size       511 / 2.00 GB
db01:~# lvm lvcreate -s VG/LV -n LV-snap -L 2.00G
  Insufficient free extents (511) in volume group VG: 512 required

(the same happens when passing to mylvmbackup with --lvsize, obviously)

the correct way to specify logical volume sizes for lvm is in extents, which
allows passing exact values without rounding errors:

db01:~# lvm vgdisplay VG | grep Free
  Free  PE / Size       511 / 2.00 GB
db01:~# lvm lvcreate -s VG/LV -n LV-snap -l 511
  Logical volume "LV-snap" created

=> it would be nice if mylvmbackup at least had an option to pass the
   snapshot size in extents. instead of bytes
   (note that newer versions of lvm also accept percentages of free space)

(i'm not a perl programmer really, but i might wrtite/subit a patch if there's
 interest in it.)

- Thorben Thuermer

Other related posts: