# [PC-BSD] lpreserver problem reverting ZFS snapshot



## mrab54 (Dec 1, 2013)

I started using the lpreserver utility from PC-BSD for automated snapshots.  I'm trying to revert a snapshot but lpreserver doesn't seem to like my syntax.


```
# lpreserver listsnap zroot/usr/home
NAME                                      USED  AVAIL  REFER  MOUNTPOINT
zroot/usr/home@auto-2013-11-10-03-00-00  65.1K      -   656G  -
zroot/usr/home@auto-2013-11-11-03-00-00      0      -   656G  -
...
zroot/usr/home@auto-2013-12-01-03-00-00      0      -   656G  -
```

Then I try to revert:

```
# lpreserver revertsnap zroot/usr/home auto-2013-11-10-03-00-00
ERROR: No such snapshot!
# lpreserver revertsnap zroot/usr/home zroot/usr/home@auto-2013-11-10-03-00-00
ERROR: No such snapshot!
lpreserver revertsnap zroot/usr/home 2013-11-10-03-00-00
ERROR: No such snapshot!
```

There is no manpage for lpreserver but here is the help output:

```
# lpreserver help revertsnap
Life-Preserver
---------------------------------
Help revertsnap

Revert ZFS to a snapshot of a dataset

Usage:

  lpreserver revertsnap <dataset> <SNAP>

Example:

  lpreserver revertsnap tank1/usr/home/kris 20130729-140510
```

Does anyone have any experience with this?


----------



## fonz (Dec 1, 2013)

This lpreserver thingy really appears to be PC-BSD specific.

PC-BSD DesktopBSD FreeNAS NAS4Free m0N0WALL pfSense ArchBSD kFreeBSD JabirOS topics


----------



## mrab54 (Dec 1, 2013)

I found a bug in one of the scripts, I'm using pcbsd-utils-1382605460.

`lpreserver revertsnap` calls /usr/local/share/lpreserver/backend/zfsrevertsnap.sh.  

zfsrevertsnap.sh

```
#!/bin/sh
# ZFS functionality
# Args $1 = DATASET
# Args $2 = zfs directive
#######################################################################

# Source our functions
PROGDIR="/usr/local/share/lpreserver"

# Source our variables
. /usr/local/share/pcbsd/scripts/functions.sh
. ${PROGDIR}/backend/functions.sh

DATASET="${1}"

if [ -z "${DATASET}" ]; then
  exit_err "No dataset specified!"
fi

revertZFSSnap "${DATASET}" "${SNAP}"
```

The script never sets 
	
	



```
SNAP="${2}"
```
With that fix, everything works as expected.


----------

