btrsync.btrfs.cmd

Programmatically generate btrfs subcommand invocations.

Functions

list(path, *[, list_all, readonly, fields])

Generate a btrfs subvolume list command.

receive(path, *[, force_decompress])

Generate a btrfs receive command.

send(*paths[, parent, clones, keep_compressed])

Generate a btrfs send command.

show(path, *[, uuid, rootid])

Generate a btrfs subvolume show command.

btrsync.btrfs.cmd.list(path, *, list_all=False, readonly=False, fields='pcguqR')[source]

Generate a btrfs subvolume list command.

Parameters
  • path – the target path to list

  • list_all – if True, list all subvolumes in the filesystem (btrfs option -a), otherwise only direct descendants of path (btrfs option -o)

  • readonly – if True, list only readonly subvolumes (btrfs option -r)

  • fields – flags selecting the subvolume fields to print (see btrfs-subvolume(8)); default is all supported

Returns

btrsync.util.Cmd instance of the desired btrfs list command

Raises

ValueError – if unsupported fields are supplied

btrsync.btrfs.cmd.receive(path, *, force_decompress=False)[source]

Generate a btrfs receive command.

Parameters
  • path – the path to receive into

  • force_decompress – if True, force the decompression of any compressed blocks in the stream (btrfs-receive option --force-decompress)

Returns

btrsync.util.Cmd instance of the desired btrfs receive command

btrsync.btrfs.cmd.send(*paths, parent=None, clones=[], keep_compressed=False)[source]

Generate a btrfs send command.

Parameters
  • paths – the target paths to send

  • parent – path of the parent volume for incremental sends (btrfs-send option -p)

  • clones – sequence of paths of clone subvolumes (btrfs-send option -c)

  • keep_compressed – if True instruct btrfs-send to output compressed blocks unchanged (btrfs-send option --compressed-data)

Returns

btrsync.util.Cmd instance of the desired btrfs send command

Raises

ValueError – if no paths are given

btrsync.btrfs.cmd.show(path, *, uuid=None, rootid=None)[source]

Generate a btrfs subvolume show command.

Parameters
  • path – path of the target subvolume or filesystem

  • uuid – show information about subvolume with specified UUID; cannot be used together with rootid

  • rootid – show information about subvolume with specified root ID; cannot be used together with uuid

Returns

btrsync.util.Cmd instance of the desired btrfs show command

Raises

ValueError – if both uuid and rootid are specified