| 1 | # Go Wrapper for ZFS |
| 2 | |
| 3 | Simple wrappers for ZFS command line tools. |
| 4 | |
| 5 | [](https://godoc.org/github.com/mistifyio/go-zfs) |
| 6 | |
| 7 | ## Requirements |
| 8 | |
| 9 | You need a working ZFS setup. To use on Ubuntu 14.04, setup ZFS: |
| 10 | |
| 11 | sudo apt-get install python-software-properties |
| 12 | sudo apt-add-repository ppa:zfs-native/stable |
| 13 | sudo apt-get update |
| 14 | sudo apt-get install ubuntu-zfs libzfs-dev |
| 15 | |
| 16 | Developed using Go 1.3, but currently there isn't anything 1.3 specific. Don't use Ubuntu packages for Go, use http://golang.org/doc/install |
| 17 | |
| 18 | Generally you need root privileges to use anything zfs related. |
| 19 | |
| 20 | ## Status |
| 21 | |
| 22 | This has been only been tested on Ubuntu 14.04 |
| 23 | |
| 24 | In the future, we hope to work directly with libzfs. |
| 25 | |
| 26 | # Hacking |
| 27 | |
| 28 | The tests have decent examples for most functions. |
| 29 | |
| 30 | ```go |
| 31 | //assuming a zpool named test |
| 32 | //error handling omitted |
| 33 | |
| 34 | |
| 35 | f, err := zfs.CreateFilesystem("test/snapshot-test", nil) |
| 36 | ok(t, err) |
| 37 | |
| 38 | s, err := f.Snapshot("test", nil) |
| 39 | ok(t, err) |
| 40 | |
| 41 | // snapshot is named "test/snapshot-test@test" |
| 42 | |
| 43 | c, err := s.Clone("test/clone-test", nil) |
| 44 | |
| 45 | err := c.Destroy() |
| 46 | err := s.Destroy() |
| 47 | err := f.Destroy() |
| 48 | |
| 49 | ``` |
| 50 | |
| 51 | # Contributing |
| 52 | |
| 53 | See the [contributing guidelines](./CONTRIBUTING.md) |