-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
Hello,
I'd like to be able to create sparse volumes using this library. To do that with zfs
command one need to specify -s
flag so a function like this would work (it's just a copy of CreateVolume
with additional flag in args[2]
):
// CreateVolume creates a new ZFS volume with the specified name, size, and
// properties.
// A full list of available ZFS properties may be found here:
// https://www.freebsd.org/cgi/man.cgi?zfs(8).
func CreateSparseVolume(name string, size uint64, properties map[string]string) (*Dataset, error) {
args := make([]string, 4, 5)
args[0] = "create"
args[1] = "-p"
args[2] = "-sV"
args[3] = strconv.FormatUint(size, 10)
if properties != nil {
args = append(args, propsSlice(properties)...)
}
args = append(args, name)
_, err := zfs(args...)
if err != nil {
return nil, err
}
return GetDataset(name)
}
rlisewski and Nowaker
Metadata
Metadata
Assignees
Labels
No labels