btrfsutil-rs
Safe wrappers for libbtrfsutil.
Building
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
Usage
Add this to your Cargo.toml
:
[]
= "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).
Examples
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 = get.unwrap;
// Retrieve a subvolume iterator for /
let subvol_iterator: SubvolumeIterator = ;
// Iterate over the subvolumes and print out their debug information
for subvolume in subvol_iterator
License
MIT