<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 27, 2017 at 9:09 PM, Spike <span dir="ltr"><<a href="mailto:spike@drba.org" target="_blank">spike@drba.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Tamas,<div><br></div><div>are you actually doing this? any gotchas?</div><div><br></div><div>I'm trying to set up exactly the same, have a live node and a backup node, both running zfs. I have the same containers, with the same mac, at destination, however I'm unclear that just by copying over the rootfs dataset from zfs it will be enough to make it work.</div></div></blockquote><div><br></div><div>Yes, this is enough. Assuming your container ONLY store data in the default rootfs (i.e. no additional disk/path added manually to the container).</div><div><br></div><div>If you also want to replicate old mac address (as well as custom configs, like physical NIC passthru) , also store the output of "lxc config show container_name > container_backup.lxc".</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Has anybody done this before? I think somebody (maybe Fajar) in the past also mentioned keeping /var/lib/lxd on zfs and replicating that too which makes a lot of sense.</div><div><br></div></div></blockquote><div><br></div><div><br></div><div>FWIW, here's more info about my setup</div><div><br></div><div>(1) relevant part of my sanoid.conf in the container host -> main purpose: hourly snapshot, to be able to rollback easily. sanoid cron runs every hour</div><div>###</div><div><div>[rpool/ROOT/ubuntu]</div><div>       use_template = rootfs</div><div>       recursive = no</div></div><div><br></div><div><div>[data/lib/lxd]</div><div>        use_template = container</div><div><br></div><div>[data/lxd/containers]</div><div>        use_template = container</div><div>        recursive = yes</div><div>        process_children_only = yes</div></div><div><div><br></div><div><div>[template_rootfs]</div><div>        hourly = 0</div><div>        daily = 7</div><div>        monthly = 1</div><div>        yearly = 0</div><div>        autosnap = yes</div><div>        autoprune = yes</div><div><br></div><div>[template_container]</div><div>        hourly = 36</div><div>        daily = 7</div><div>        monthly = 1</div><div>        yearly = 0</div><div>        autosnap = yes</div><div>        autoprune = yes</div></div><div>###<br></div><div></div></div><div><br><br>(2) sync to backup host job -> syncoid, runs daily on the backup host. 'backup-cold' is zfs pool backed by AWS SC1 (cheap, cold HDD with lower throughput) Note that I DON'T replicate the host's rootfs (rpool/ROOT/ubuntu), as I can quickly restore a fresh one from my custom AMI if needed.<br><br>###</div><div><div>echo $(date) syncoid start</div><div>## generic container backup<br></div><div># host list</div><div>for h in container_host1 container_host2 container_hostN ;do</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>echo $(date) processing $h</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>zfs create -p backup-cold/$h/lxd</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>syncoid syncoid@$h:data/lib/lxd backup-cold/$h/lxd/lib</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>syncoid -r syncoid@$h:data/lxd/containers backup-cold/$h/lxd/containers</div><div>done</div><div>echo $(date) syncoid end</div></div><div>###<br><br>(3) relevant part of sanoid.conf in the backup host -> main purpose: prune old snapshots (sent from container host)<br><div><br></div><div>###</div><div>[backup-cold]<br></div><div>        use_template = backup</div><div>        recursive = yes</div><div>        process_children_only = yes</div><div><br></div><div><div>[template_backup]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>hourly = 0</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>daily = 45</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>monthly = 6</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>yearly = 0</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>autoprune = yes</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>autosnap = no<br></div></div><div>###</div><div><br></div><div>-- </div><div>Fajar</div></div></div></div></div>