]>
Commit | Line | Data |
---|---|---|
9b104ea3 JR |
1 | Amanda LVM-snapshot Plugin |
2 | ========================== | |
3 | ||
4 | This plugin provides support for LVM snapshots in Amanda dumps. It interfaces | |
5 | with Amanda through the [Script API][1]. | |
6 | ||
7 | Install | |
8 | ------- | |
9 | ||
10 | Sorry, there's no Makefile yet. Simply copy the amlvm-snapshot.pl script into | |
11 | Amanda's application directory. | |
12 | ||
13 | For example: | |
14 | ||
15 | cp amlvm-snapshot.pl /usr/libexec/amanda/application/amlvm-snapshot | |
16 | ||
17 | You may need to edit the location of Amanda's Perl libraries in the script | |
18 | itself, the following line. | |
19 | ||
20 | use lib '/usr/local/share/perl/5.8.4'; | |
21 | ||
22 | Configure Amanda | |
23 | ---------------- | |
24 | ||
25 | Somewhere in your Amanda config you must define a `script-tool` that loads the | |
26 | plugin. You can simply include the provided `lvm-snapshot.conf` file if you like. | |
27 | ||
28 | cp lvm-snapshot.conf /etc/amanda/DailySet1/lvm-snapshot.conf | |
29 | echo 'includefile "lvm-snapshot.conf"' >> /etc/amanda/DailySet1/amanda.conf | |
30 | ||
31 | Once you have the `lvm-snapshot` `script-tool` defined, you can include it in | |
32 | a `dumptype` definition. Note, however, that your dumptype _must use an | |
33 | application-tool program_: Only application-tool programs can handle the | |
34 | alternate mount point—of the snapshot device—that the script defines. | |
35 | ||
36 | define dumptype lvm-comp-amgtar { | |
37 | comment "LVM snapshot dumped with amgtar" | |
38 | global | |
39 | program "APPLICATION" | |
40 | application "app_amgtar" | |
41 | script "lvm-snapshot" | |
42 | compress client fast | |
43 | index | |
44 | } | |
45 | ||
46 | To allow amanda to dump more than one lvm-snapshot in parallel, | |
47 | lvm-snapshot.conf has to have something like: | |
48 | ||
49 | property "SNAPSHOT-SIZE" "250" | |
50 | ||
51 | (the unit is PEs, for LVM PE Size 4,00 MiB it results in 1G snapshot-size) | |
52 | ||
53 | otherwise the first snapshot uses up all extents and the second snapshot fails. | |
54 | ||
55 | Configure Permissions | |
56 | --------------------- | |
57 | ||
58 | This plugin requires elevated permissions in order to create and remove LVM | |
59 | devices. There are two ways to provide access: setting setuid on the plugin | |
60 | script itself, or by configuring `sudo` to allow execution of the LVM | |
61 | programs. | |
62 | ||
63 | ### setuid | |
64 | ||
65 | NOTE: I'm currently having trouble getting this to work right, as Amanda's | |
66 | Perl libraries don't seem to play nice with setuid scripts. | |
67 | ||
68 | For setuid, simply configure the ownership and mode on `amlvm-snapshot`. In | |
69 | this example, `disk` is the group that Amanda runs under. | |
70 | ||
71 | chown root:disk /usr/libexec/amanda/application/amlvm-snapshot | |
72 | chmod 4750 /usr/libexec/amanda/application/amlvm-snapshot | |
73 | ||
74 | This will require that you have a version of Perl installed that was compiled | |
75 | with `ENABLE_SUIDPERL`. | |
76 | ||
77 | ### sudo | |
78 | ||
79 | For sudo, add the following to the `/etc/sudoers` file where "amandabackup" is | |
80 | the name of your Amanda user. | |
81 | ||
82 | amandabackup ALL=(ALL) NOPASSWD: /sbin/lvcreate, /sbin/lvdisplay, /sbin/lvremove, /sbin/vgdisplay, /bin/readlink, /bin/mount, /bin/umount, /sbin/blkid | |
83 | ||
84 | The commands listed are those used by `amlvm-snapshot` to interact with the | |
85 | LVM volumes. | |
86 | ||
87 | Remember to enable the `SUDO` property. This is already included in the | |
88 | example `lvm-snapshot.conf` file. | |
89 | ||
90 | define script-tool lvm-snapshot { | |
91 | # ... | |
92 | property "SUDO" "1" | |
93 | } | |
94 | ||
95 | Enjoy, | |
96 | Daniel | |
97 | ||
98 | [1]: http://wiki.zmanda.com/index.php/Script_API |