Fileset Examples

The FileSet example below will backup all files from both the centos and gentoo virtual machines.

FileSet {
  Name = FS_KVM
  Include {
    Options {
      Signature = MD5
      Compression = LZO
    }
    Plugin = "kvm: host=centos,gentoo"
  }
}

If a KVM FileSet contains multiple virtual machines, each file’s path in the Catalog will begin with the name of the virtual machine as shown in the example listing below.

* list files jobid=100
+---------------------------------+
| filename                        |
+---------------------------------+
| ...                             |
| /centos/boot                    |
| /centos/boot/grub               |
| /centos/boot/grub/menu.lst      |
| ...                             |
| /gentoo/etc/passwd              |
| /gentoo/etc/group               |
| /gentoo/etc/hosts               |
| ...                             |
+ --------------------------------+

If a KVM FileSet contains only one virtual machine, each file’s path will not be prefixed with the virtual machine’s name, as shown below. This default behavior can be overridden by using the host_prefix KVM plugin parameter listed in table KVM Plugin Options.

FileSet {
  Name = FS_KVM_centos
  Include {
    Plugin = "kvm: host=centos"
  }
}
* list files jobid=101
+---------------------------------+
| filename                        |
+---------------------------------+
| ...                             |
| /boot                           |
| /boot/grub                      |
| /boot/grub/menu.lst             |
| ...                             |
+ --------------------------------+

Including and Excluding Files

With the KVM Plugin, by default all files in the virtual machine are backed up and the FileSet’s Include and Exclude directives are ignored.

FileSet {
  Name = FS_KVM_broken
  Include {
    Plugin = "kvm: host=centos"  # all files on centos VM will be backed up
    File = /etc                  # will be ignored due to KVM plugin
    File = /home                 # will be ignored due to KVM plugin
  }
  Exclude {
    File = /tmp                  # will be ignored due to KVM plugin
  }
}

Note

Selection rules defined in Options blocks are still applied.

If certain directories should be excluded from the virtual machine’s backup, the include and exclude plugin options can be used. The FileSet example below will backup files under /etc and /home. Files below /home/tmp will be explicitly excluded.

FileSet {
  Name = FS_KVM_etc_home
  Include {
    Plugin = "kvm: host=centos include=/etc include=/home exclude=/home/tmp"
  }
}

When the include plugin option is specified, the default behavior of backing up all files in the VM is overridden and only directories specified by the include plugin options are backed up.

To manage exclude lists, it is also possible to use the Exclude Dir Containing FileSet directive. In the example below, all files and directories on the virtual machine named “centos” will be backed up except for directories containing a file named .excludeme

FileSet {
  Name = FS_KVM_centos
  Include {
    Options {
    Signature = MD5
    }
    Exclude Dir Containing = ".excludeme"
    Plugin = "kvm: host=centos"
  }
}

If more complex Include or Exclude capabilities are required, it may be useful to consider installing a Bacula File Daemon inside the virtual machine instead of using the KVM Plugin.

KVM Configuration

KVM Configuration

See also

Go back to the main KVM Configuration page.

Go back to the main KVM Plugin page.