remote_backup

Use btrfs send/receive to send snapshot to a remote computer.

snapintime.remote_backup.btrfs_send_receive(local_subvols: list, remote_subvol: str, backup_location: str, remote_location: str, remote_subvol_dir: str)

Run command to send/receive btrfs snapshot.

Parameters
  • local_subvols – A list of the local subvolumes to choose from.

  • remote_subvol – The latest subvolume that is present on both the remote and local systems.

  • backup_location – The folder prefix for teh local_subvol

  • remote_location – This should be a string like user@computer or user@IPaddress

  • remote_subvol_dir – This is the directory we will put the backup into on the remote system.

Returns

A dictionary with the result of the command.

snapintime.remote_backup.get_local_subvols(local_subvol_dir: str) list

Grab the subvolumes from the local directory.

Parameters

local_subvol_dir – The directory containing the local subvolumes.

Returns

A list of all the local subvolumes

snapintime.remote_backup.get_remote_subvols(remote_location: str, remote_subvol_dir: str) list

Retrieve the remote subvolumes.

This function assumes user has set up ssh keys for paswordless login.

Parameters
  • remote_location – This should be a string like user@computer or user@IPaddress

  • remote_subvol_dir – This is the directory we will search to get the latest subvolume.

Returns

A list of the remove subvolumes.

snapintime.remote_backup.iterate_configs(config: dict) list

Iterate over all the subvolumes in the config file, then call btrfs_send_receive if the value of remote is “True”.

Parameters

config – The config file, parsed by import_config.

Returns

A list containing return values from btrfs_send_receive

snapintime.remote_backup.main()
snapintime.remote_backup.match_subvols(local_subvols: list, remote_subvols: list) str

Return the latest remote subvol that also exists on the local system.

Parameters
  • local_subvols – A list of the local subvolumes.

  • remote_subvols – A list of the remote subvolumes.

Returns

The subvolume.