Safe wrappers for libbtrfsutil.
This library links to libbtrfsutil
, a shared library provided by installing btrfs-progs on most Linux systems.
- Arch Linux:
# pacman -S btrfs-progs
- Ubuntu:
# apt install btrfs-progs
Add this to your Cargo.toml
:
[dependencies]
btrfsutil = "0.1.0"
For further details, please refer to the documentation.
Also, please keep in mind that many of the operations this library can perform may require elevated privileges(CAP_SYSTEM_ADMIN).
How to run examples with elevated privileges:
- build with:
cargo build --examples
- execute with:
sudo target/debug/examples/example_name
.
This example requires elevated privileges.
// This will print out informations about all subvolumes under /
// Retrieve the subvolume for /
let root_subvol = Subvolume::get("/").unwrap();
// Retrieve a subvolume iterator for /
let subvol_iterator: SubvolumeIterator = {
let result: Result<SubvolumeIterator> = root_subvol.into();
result.unwrap()
};
// Iterate over the subvolumes and print out their debug information
for subvolume in subvol_iterator {
println!("{:?}", subvolume.info().unwrap());
}
MIT