Expand description
Structure representing what zpool consist of. This structure is used in zpool creation and when new drives are attached.
Examples
Let’s create simple topology: 2 drives in mirror, no l2arc, no zil.
use libzetta::zpool::{CreateVdevRequest, CreateZpoolRequest};
use std::path::PathBuf;
let drives = vec![PathBuf::from("sd0"), PathBuf::from("sd1")];
let topo = CreateZpoolRequest::builder()
.name(String::from("tank"))
.vdevs(vec![CreateVdevRequest::Mirror(drives)])
.build()
.unwrap();
Overkill example: 2 drives in mirror and a single drive, zil on double mirror and 2 l2rc.
use libzetta::zpool::{CreateZpoolRequest, CreateVdevRequest};
use std::path::PathBuf;
let zil_drives = vec![PathBuf::from("hd0"), PathBuf::from("hd1")];
let mirror_drives = vec![PathBuf::from("hd2"), PathBuf::from("hd3")];
let cache_drives = vec![PathBuf::from("hd4"), PathBuf::from("hd5")];
let topo = CreateZpoolRequest::builder()
.name("tank")
.vdevs(vec![CreateVdevRequest::Mirror(mirror_drives)])
.cache("/tmp/sparse.file".into())
.vdev(CreateVdevRequest::SingleDisk(PathBuf::from("hd6")))
.caches(cache_drives)
.zil(CreateVdevRequest::Mirror(zil_drives))
.altroot(PathBuf::from("/mnt"))
.mount(PathBuf::from("/mnt"))
.build()
.unwrap();
Structs
- Consumer friendly representation of zpool structure.
- Builder for
CreateZpoolRequest
.
Enums
- Error type for CreateZpoolRequestBuilder