This function can be used to very easily create a snapshot.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
return %subvolumes;
}
+#
+## Easy to use function to create a new snapshot with a given name.
+#
+sub btrfs_create_snapshot ($) {
+ my ($name) = @_;
+
+ # Call btrfsctrl to create the new snapshot and pass the name.
+ my $ret = &General::system("$btrfsctrl", "snapshot-create", "$name");
+
+ # Return the return code if there was one.
+ return $ret if($ret);
+
+ # Return nothing on success.
+ return;
+}
+
#
## Private function to filter the output of btrfs_subvolume_list command.
##