[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ezjail_use_zfs, update -i and zfs send | receive


I'm backing up the whole jails server via something akin to:
  zfs send  -R -I  zroot@auto_2014-10-26_00.00.00--2w zroot@auto_2014-10-26_00.00.00--2w" | zfs receive -v -d z/bk/srv.example.com/B

After ezjail-admin update -i:
  cannot receive new filesystem stream: destination 'z/bk/srv.example.com/B/j/newjail' exists
  must specify -F to overwrite it

The following code is to blame
  # Try to remove the old template jail
  if [ "${ezjail_use_zfs}" = "YES" ]; then
    [ -d "${ezjail_jailtemplate}" ] && zfs destroy -R ${ezjail_jailzfs}/newjail && rm -rf "${ezjail_jailtemplate}"
    cd ${ezjail_jaildir}
    zfs rename ${ezjail_jailzfs}/fulljail ${ezjail_jailzfs}/newjail
    [ -d "${ezjail_jailtemplate}" ] && chflags -R noschg "${ezjail_jailtemplate}" && rm -rf "${ezjail_jailtemplate}"
    mv "${ezjail_jailfull}" "${ezjail_jailtemplate}"
and also has the side effect of deleting all the daily snapshots for
${ezjail_jailzfs}/newjail (arguably not a problem in itself except if
one does changes something in it by hand). But the purpose of my setup
is to be able to restore a failed server with all its history.

I can work around this by either customizing my back-up/restore scripts
or making the else above noop. However maybe a config file option or
cmd switch would be preferable?

IOnut - Un^d^dregistered ;) FreeBSD "user"
  "Intellectual Property" is   nowhere near as valuable   as "Intellect"
FreeBSD committer -> itetcu AT FreeBSD DOT org, PGP Key ID 29597D20