Discussion:
[rsnapshot-discuss] LVM thin support
Hervé Werner
2015-06-10 12:22:31 UTC
Permalink
Hello

Rsnapshot is able to create temporary LVM snapshots to backup datas so that it has a consistent view of the whole volume, and that's great. Today LVM also offers thin provisionning (for more information : https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/thinly-provisioned_snapshot_volumes.html). As for rsnapshot this would permit :
to simplify lthe lvcreate command (and the user configuring rsnapshot) by discarding the size option
to create snapshot of snapshot. Eg I use thin snapshots to quickly backup my datas daily and then I also rely on rsnapshot to backup the latest snapshot on an external disk weekly
Please see attached a quick & dirty patch I did for my needs. To use it you only need to put in rsnapshot.conf :
linux_lvm_snapshotsize = 'lvmthin' # (lvmthin instead of a LVM size)


If you are interested in adding this feature in rsnapshot but would like this patch to get reworked, I'd be glad to help.

Regards

dud
Benedikt Heine
2015-06-10 22:53:54 UTC
Permalink
Hi dud,

> On June 10, 2015 at 2:22 PM Hervé Werner <***@hotmail.com> wrote:
> If you are interested in adding this feature in rsnapshot but would like
> this patch to get reworked, I'd be glad to help.

Indeed, you can work on it.

I'll give you some hints, where your patches have to change something:
- write unittests (the corresponding PR is not merged yet, so you may have
to wait a bit till you can finish unittests)
- add Pod documentation
- add documentation to rsnapshot.conf.in

What would it be, if the linux_lvm_snapshotsize is by default `undef` and
then behaves like 'lvmthin'? And only by setting an explicit value, the
snapshot_size will be regarded.

Cheers,
Bene

------------------------------------------------------------------------------
Hervé Werner
2015-06-16 18:31:42 UTC
Permalink
> Date: Thu, 11 Jun 2015 00:53:54 +0200
> From: ***@heine.rocks
> To: rsnapshot-***@lists.sourceforge.net; ***@hotmail.com
> Subject: Re: [rsnapshot-discuss] LVM thin support
>
> Hi dud,
>
> > On June 10, 2015 at 2:22 PM Hervé Werner <***@hotmail.com> wrote:
> > If you are interested in adding this feature in rsnapshot but would like
> > this patch to get reworked, I'd be glad to help.
>
> Indeed, you can work on it.
>
> I'll give you some hints, where your patches have to change something:
> - write unittests (the corresponding PR is not merged yet, so you may have
> to wait a bit till you can finish unittests)
> - add Pod documentation
> - add documentation to rsnapshot.conf.in
>
> What would it be, if the linux_lvm_snapshotsize is by default `undef` and
> then behaves like 'lvmthin'? And only by setting an explicit value, the
> snapshot_size will be regarded.
>

Hello

As requested I reworked a bit my patch. Now it does complete checking on the lvm_snapshot_size parameter : it could only be equal to the string "lvmthin" or to a regex size that is accepted by lvcreate, any other case makes rsnapshot to fail. If lvmthin is used, an extra check is done to ensure the source LVM volume is thinly-provisionned, unfortunately this check uses an additionnal command : lvs. So if this patch is accepted as is, from now it will fail if linux_lvm_cmd_lvs is not set.

Concerning the unittest, I noticed there isn't any LVM so far. I've thought a little bit how to implement this and the major question is : which test volume is going to be snapshotted ? I don't know if there is a way to get this information from the user in a unit test ? We could try to detect it automatcally based on the current directory, but this will not allow to test both normal LV snapshots and thin snapshots.
So any idea to implement LVM unit tests is welcome :)


Let me know what do you think about this patch and if it stiil needs some review.

Regards

dud
Loading...