How Can I Access Old Boot Snapshots?

NASbox

Guru
Joined
May 8, 2012
Messages
650
I am running FreeNAS 11.1-U7, and for some reason my FreeNAS would not boot (likely do to an earlier update) and I had to reinstall and restore the config.

This caused a bit of a probem because I had some customization in /root that I want to recover.

AFAIK /root lives in freenas-boot/ROOT/11.1-U7-Please correct me if I am wrong.

If that is the case, the files I want are in this snapshot:

Code:
freenas# zfs list -t snap -r freenas-boot/ROOT/11.1-U7
NAME                                            USED  AVAIL  REFER  MOUNTPOINT
[SNIP]
freenas-boot/ROOT/11.1-U7@2019-01-29-15:38:10  1.04G      -  1.04G  -


For ease of working I would like to just create /TMPMOUNT and mount the snapshot ReadOnly to this mount point. Can someone tell me how to do this without messing things up.

Thanks.

Just in case I need to look somewhere else, here are the datasets on the boot drive.

Code:
freenas-boot                                                   10.7G  96.8G   176K  none
freenas-boot/.system                                            180M  96.8G  4.34M  legacy
freenas-boot/.system/configs-66c5ca0d9b594eb08a0e7191ec86e4a6  73.6M  96.8G  73.6M  legacy
freenas-boot/.system/configs-9d613bc4d69d4caa9ab03b2439285b53   136K  96.8G   136K  legacy
freenas-boot/.system/cores                                     16.8M  96.8G  16.8M  legacy
freenas-boot/.system/rrd-66c5ca0d9b594eb08a0e7191ec86e4a6      31.1M  96.8G  31.1M  legacy
freenas-boot/.system/rrd-9d613bc4d69d4caa9ab03b2439285b53      3.85M  96.8G  3.85M  legacy
freenas-boot/.system/samba4                                     468K  96.8G   468K  legacy
freenas-boot/.system/syslog-66c5ca0d9b594eb08a0e7191ec86e4a6   49.5M  96.8G  49.5M  legacy
freenas-boot/.system/syslog-9d613bc4d69d4caa9ab03b2439285b53    296K  96.8G   296K  legacy
freenas-boot/CUSTOM                                             163M  96.8G  78.4M  /CUSTOM
freenas-boot/ROOT                                              10.3G  96.8G   136K  none
freenas-boot/ROOT/11.0-U3                                       232K  96.8G   970M  /
freenas-boot/ROOT/11.0-U4                                       248K  96.8G   973M  /
freenas-boot/ROOT/11.1-RELEASE                                  424K  96.8G  1.08G  /
freenas-boot/ROOT/11.1-U4                                       452K  96.8G  1.09G  /
freenas-boot/ROOT/11.1-U5                                       452K  96.8G  1.10G  /
freenas-boot/ROOT/11.1-U6                                       572K  96.8G  1.10G  /
freenas-boot/ROOT/11.1-U6.3                                     440K  96.8G  1.04G  /
freenas-boot/ROOT/11.1-U7                                      9.32G  96.8G  1.07G  /
freenas-boot/ROOT/Initial-Install                                 8K  96.8G   980M  legacy
freenas-boot/ROOT/default                                       232K  96.8G   980M  legacy
freenas-boot/ROOT/default-20190917-081209                      1018M  96.8G  1018M  legacy
freenas-boot/grub                                              7.94M  96.8G  7.94M  legacy
 

droeders

Contributor
Joined
Mar 21, 2016
Messages
179
You can use 'zfs clone' to duplicate/mount a snapshot to a new dataset. The FreeBSD man page for 'zfs' has this:

Code:
The following command creates a writable file system whose initial con-
tents are the same as pool/home/bob@yesterday.

   # zfs clone pool/home/bob@yesterday pool/clone


This article shows example usage as well:
https://www.howtoforge.com/tutorial/how-to-use-snapshots-clones-and-replication-in-zfs-on-linux/

Keep in mind that you'll need to destroy your cloned dataset after use, or the snapshot it's based on cannot be destroyed.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
You can use 'zfs clone' to duplicate/mount a snapshot to a new dataset. The FreeBSD man page for 'zfs' has this:

Code:
The following command creates a writable file system whose initial con-
tents are the same as pool/home/bob@yesterday.

   # zfs clone pool/home/bob@yesterday pool/clone


This article shows example usage as well:
https://www.howtoforge.com/tutorial/how-to-use-snapshots-clones-and-replication-in-zfs-on-linux/

Keep in mind that you'll need to destroy your cloned dataset after use, or the snapshot it's based on cannot be destroyed.

Thanks @droeders ... I created a clone with:
zfs clone freenas-boot/ROOT/11.1-U7@2019-01-29-15:38:10 freenas-boot/TEMPCLONE
Now, how do I mount it?

zfs list shows no mountpoint
Code:
freenas-boot/TEMPCLONE                                            8K  96.8G  1.04G  none


Edit:
I found a work around by doing:
zfs set -o mountpoint=/TEMPCLONE freenas-boot/TEMPCLONE
This mounted the clone at /TEMPCLONE and I was able to copy the files I needed.
I did a zfs destroy freenas-boot/TEMPCLONE and then rmdir /TEMPCLONE to clean up when I was done

For the benefit of others maybe someone could complete the following:

How should this statement be coded so it would mount then created snapshot?
zfs clone freenas-boot/ROOT/11.1-U7@2019-01-29-15:38:10 freenas-boot/TEMPCLONE
would
zfs clone -o mountpoint=/TEMPCLONE freenas-boot/ROOT/11.1-U7@2019-01-29-15:38:10 freenas-boot/TEMPCLONE
work?

ALSO

Is it necessary to clone the snapshot, or is it possible to simply mount the existing snapshot? (ReadOnly!)

What would happen if I did:
zfs set -o mountpoint=/TEMPMPUNT freenas-boot/ROOT/11.1-U7@2019-01-29-15:38:10
Would that mount the snapshot?
Would this screw anything up?
Would the snapshot be Readonly, or could it be damaged by overwriting?

Assuming the above worked, how would I "unset" the mountpoint option back to "not mounted" the way it was originally?
 
Last edited:
Top