I am using a dedicated server, and unlike on VPS providers or VM machines, getting back to a clean state (untouched, after install) is quite a laborious thing to do (lots of clicking around in a web control panel and launching Java KVM viewers + doing the installation manually).
My question is that given ZFS support for snapshots, would it be possible to get back to a clean state just by issuing a single command?
My ZFS partition table would be the "Auto (ZFS)" offer by the installer, which looks like this on my server (using FreeBSD 10.2):
NAME USED AVAIL REFER MOUNTPOINT zroot 34.8G 176G 96K /zroot zroot/ROOT 1.46G 176G 96K none zroot/ROOT/default 1.46G 176G 1.46G / zroot/tmp 76.8M 176G 76.8M /tmp zroot/usr 33.2G 176G 96K /usr zroot/usr/home 32.6G 176G 32.6G /usr/home zroot/usr/ports 631M 176G 631M /usr/ports zroot/usr/src 96K 176G 96K /usr/src zroot/var 692K 176G 96K /var zroot/var/audit 96K 176G 96K /var/audit zroot/var/crash 96K 176G 96K /var/crash zroot/var/log 204K 176G 204K /var/log zroot/var/mail 96K 176G 96K /var/mail zroot/var/tmp 104K 176G 104K /var/tmp
My questions are the following:
Is it possible to get back to this clean state using ZFS snapshots? What if I changed the kernel, deleted half the file-system, etc. Can a snapshot revert back everything like if it was just after installation?
If yes, how can I do that? What command do I need to create the snapshot and what do I need to revert to one?