Btrbk: Difference between revisions

imported>Onny
mNo edit summary
imported>Onny
Expanded remote host setup instructions
Line 19: Line 19:
Following example configuration will create a weekly incremental backup of a local Btrfs subvolume called <code>nixos</code> and sends it compressed to the remote host <code>myhost</code>. The mount point <code>/btr_pool</code>, as referenced above, contains the subvolume.
Following example configuration will create a weekly incremental backup of a local Btrfs subvolume called <code>nixos</code> and sends it compressed to the remote host <code>myhost</code>. The mount point <code>/btr_pool</code>, as referenced above, contains the subvolume.


The user <code>btrbk</code> together with the private key <code>/etc/btrbk_key</code> is used for authentication. The user has to be created on the remote host and needs root permissions on the commands <code>btrfs</code>, <code>readlink</code> and <code>test</code>, for example via [[sudo]].
The user <code>btrbk</code> together with the private key <code>/etc/btrbk_key</code> is used for authentication.


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
Line 39: Line 39:
</nowiki>}}
</nowiki>}}


For transport stream compression using <code>lz4</code> to work, the package must also be installed on the target host.
The user has to be created on the remote host and needs root permissions on the commands <code>btrfs</code>, <code>readlink</code> and <code>test</code>, for example via [[sudo]]. For transport stream compression using <code>lz4</code> to work, the package must also be installed on the target host:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
security.sudo = {
  enable = true;
  extraRules = [{
    commands = [
      {
        command = "${pkgs.coreutils-full}/bin/test";
        options = [ "NOPASSWD" ];
      }
      {
        command = "${pkgs.coreutils-full}/bin/readlink";
        options = [ "NOPASSWD" ];
      }
      {
        command = "${pkgs.btrfs-progs}/bin/btrfs";
        options = [ "NOPASSWD" ];
      }
    ];
    users = [ "picloud" ];
  }];
};
 
environment.systemPackages = [ pkgs.lz4 ];
</nowiki>}}


== Manual usage ==
== Manual usage ==