# zfs-snapshot-mgmt and root filesystem



## john_doe (Oct 9, 2009)

Anyone tried to use the script like this?
	
	



```
snapshot_prefix: auto-
filesystems:
  h:
    creation_rule:
      at_multiple: 10
      offset: 0
    preservation_rules:
      - { for_minutes:    90, at_multiple:    0, offset:    0 }
      - { for_minutes:   720, at_multiple:   30, offset:    0 }
      - { for_minutes: 10080, at_multiple:  180, offset:  120 }
```
For some reason it fails on me
	
	



```
# zfs-snapshot-mgmt
/usr/local/bin/zfs-snapshot-mgmt:157:in `pool': private method `chop' called for nil:NilClass (NoMethodError)
        from /usr/local/bin/zfs-snapshot-mgmt:186:in `initialize'
        from /usr/local/bin/zfs-snapshot-mgmt:186:in `map'
        from /usr/local/bin/zfs-snapshot-mgmt:186:in `initialize'
        from /usr/local/bin/zfs-snapshot-mgmt:199:in `new'
        from /usr/local/bin/zfs-snapshot-mgmt:199
```
However, if I use any filesystem below h[1] e.g., h/home, it doesn't.

[1] `h' is the pool's name

I just want to take snapshots of /etc or /boot in case of a broken update or a user error. They are usually located on root dataset.
	
	



```
$ ruby -v
ruby 1.8.7 (2009-04-08 patchlevel 160) [amd64-freebsd8]
$ pkg_info -xE zfs ruby
ruby+oniguruma-1.8.7.160_4,1
zfs-snapshot-mgmt-20090201
```


----------



## knarf (Oct 13, 2009)

I don't have this problem, because I use root1/root as /


```
% df /
Filesystem 1M-blocks Used  Avail Capacity  Mounted on
root1/root    457653  123 457529     0%    /
```

Knarf


----------



## hartzell (Nov 8, 2009)

*fix for zfs-snapshot-mgmt and single level filesystems*

The script expects a filesystem hierarchy, where the names have at least one / character.

I have a single filesystem, zroot.

I changed line 157 to


```
name[/\A[^\/]*/]
```

and it works for me.

A bit of poking suggests that it'll still work for zroot/foo but I haven't tested it.


----------

