Currently I have three jails running:
dns
mail
www
I have been working in www mostly and once I got nginx and drupal(including DB) working I needed to take a snapshot so if I goofed it up I could get back to this starting point.
I used the following command to backup the r/w portion of the jail:
Code:
su root -c "zfs snapshot jpool/jails/js/www@v7Drupal`date "+%Y%m%d-%H%M" ` "
you can get a list of your zfs snapshots using:
Code:
zfs list -t snapshot
I took this particular snapshot while the jail was running or not but probably best if you shut it down. Only takes a second and 0 space initially.
After loading a Theme and trying to run a Drupal helper called: Drush I ended up with a www jail that was broken. It took some work to get my drupal updated to v7 so rather than go thru all that again I just restored the snapshot.
Before restoring I needed to stop the jail. I have had some issues with my r/o mount not un-mounting automatically so I check to see if it is mounted and if so I force it to unmount:
Code:
# su - root -c "service jail stop www "
# mount | grep www
# su - root -c "umount -f /jpool/jails/j/www "
# mount
Once that was done I just restored the snapshot to the last good point that I had available:
Code:
# zfs list -t snapshot
# su - root -c "zfs rollback jpool/jails/js/www@v7Drupal20140920-1841 "
# zfs list -t snapshot
# su - root -c "service jail start www "
# jls
When I started the jail it came up just like I had just updated to Drupal v7. Site was up and working like nothing happened, database and all.
Also, ZFS has "send/receive" commands that allow you to save a snapshot to an archive file or restore a snapshot from an archive file.
This facility should be good for not only archiving snapshots/backups but transferring them from one system to another.
I also snapshotted my "jpool/jails/j" which gets me my master and skeleton read only infrastructure.
Code:
user@JailHost:~ % zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
jpool/jails/j@20140926-2015 0 - 46.6K -
jpool/jails/js/dns@20140919-1602 276K - 2.04M -
jpool/jails/js/mail@new20140924-1745 239K - 2.22M -
jpool/jails/js/www@20140916-1855 4.12M - 32.5M -
jpool/jails/js/www@20140919-1321 22.3M - 701M -
jpool/jails/js/www@v6Drupal20140922-1812 29.7M - 780M -
jpool/jails/js/www@v7Drupal20140922-2041 13.3M - 808M -
rpool/usr/src@20140904 545M - 545M -
-Ben