How to make a snapshot of the "whole" zroot (ZFS-on-root)?

2

I have tried the experimental ZFS-on-root partitioning scheme available on FreeBSD 10. It seems to work fine except for a booting problem that I can quickly overcome.

Anyway, this is the "partition" layout according to df.

Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default     24G    4.0G     20G    17%    /
devfs                 1.0K    1.0K      0B   100%    /dev
zroot/tmp              20G    192K     20G     0%    /tmp
zroot/usr/home         20G    188K     20G     0%    /usr/home
zroot/usr/ports        20G    144K     20G     0%    /usr/ports
zroot/usr/src          21G    1.1G     20G     5%    /usr/src
zroot/var              20G     38M     20G     0%    /var
zroot/var/crash        20G    148K     20G     0%    /var/crash
zroot/var/log          20G    248K     20G     0%    /var/log
zroot/var/mail         20G    144K     20G     0%    /var/mail
zroot/var/tmp          20G    152K     20G     0%    /var/tmp

I ran

zfs snapshot zroot@fresh

after 1st boot/. But when I rolled back to that snapshot, nothing seemed to happened. The changes I made to some files in /etc are still there. The files retrieved from an svn checkout I performed in /usr/src are still present.

What I want to do is to make a snapshot of the "whole" zroot so that i can restore everything to that snapshot. Can someone please help? thanks

Thanks very much :)

mrjayviper

Posted 2014-05-10T23:54:29.477

Reputation: 556

Answers

4

You can recursively create snapshot by:

zfs snapshot -r zroot@fresh

marcinc

Posted 2014-05-10T23:54:29.477

Reputation: 41

1

You cannot make a snapshot of a zpool (zroot in your case). You can only take snapshots of filesystems on the zpool. What you can do is make snapshots of all relevant filesystems:

for fs in $(zfs list | grep ^zroot | awk '{print $1;}'
do
  echo "Making snapshot of ${i}"
  zfs snapshot ${fs}@fresh
done

mtak

Posted 2014-05-10T23:54:29.477

Reputation: 11 805