How can I access files from an old boot environment?

NASbox

Guru
Joined
May 8, 2012
Messages
650
I just upgraded from 11.1-U7 to 11.2-U7 and I forgot to back up a couple of small scripts that were stored in /root

I tried cd to /.zfs/snapshot/ but all it contains is 2019-11-28-16:20:43 which is a snapshot for freenas-boot/ROOT/11.2-U7.

How can I access the snapshots for freenas-boot/ROOT/11.1-U7 so I can access files in my old /root directory?

Output from zfs list -t all -r freenas-boot:
Code:
freenas-boot/ROOT                                              11.3G  95.8G   136K  none
freenas-boot/ROOT/11.0-U3                                       232K  95.8G   970M  /
freenas-boot/ROOT/11.0-U4                                       248K  95.8G   973M  /
freenas-boot/ROOT/11.1-RELEASE                                  424K  95.8G  1.08G  /
freenas-boot/ROOT/11.1-U4                                       452K  95.8G  1.09G  /
freenas-boot/ROOT/11.1-U5                                       452K  95.8G  1.10G  /
freenas-boot/ROOT/11.1-U6                                       572K  95.8G  1.10G  /
freenas-boot/ROOT/11.1-U6.3                                     440K  95.8G  1.04G  /
freenas-boot/ROOT/11.1-U7                                      9.32G  95.8G  1.07G  /
freenas-boot/ROOT/11.1-U7@2017-09-20-01:21:53                  4.05M      -   980M  -
freenas-boot/ROOT/11.1-U7@2017-09-19-23:36:41                  4.06M      -   980M  -
freenas-boot/ROOT/11.1-U7@2017-09-29-02:04:28                   969M      -   970M  -
freenas-boot/ROOT/11.1-U7@2017-12-15-20:16:16                   971M      -   973M  -
freenas-boot/ROOT/11.1-U7@2018-05-03-01:15:15                  1.08G      -  1.08G  -
freenas-boot/ROOT/11.1-U7@2018-06-18-15:51:46                  1.09G      -  1.09G  -
freenas-boot/ROOT/11.1-U7@2018-10-11-17:12:16                  1.09G      -  1.10G  -
freenas-boot/ROOT/11.1-U7@2019-01-16-03:04:16                  1.09G      -  1.10G  -
freenas-boot/ROOT/11.1-U7@2019-01-29-15:38:10                  1.04G      -  1.04G  -
freenas-boot/ROOT/11.2-U7                                      2.01G  95.8G  1.02G  /
freenas-boot/ROOT/11.2-U7@2019-11-28-16:20:43                  1017M      -  1018M  -
freenas-boot/ROOT/Initial-Install                                 8K  95.8G   980M  legacy
freenas-boot/ROOT/default                                       232K  95.8G   980M  legacy
freenas-boot/ROOT/default-20190917-081209                       360K  95.8G  1018M  legacy
freenas-boot/grub                                              7.94M  95.8G  7.94M  legacy
 

Fredda

Guru
Joined
Jul 9, 2019
Messages
608
You'll need to do the following:

Temporary move the mountpoint:
zfs set mountpoint=/tmp/mnt freenas-boot/ROOT/11.1-U7

Mount it:
mkdir /tmp/mnt
zfs mount freenas-boot/ROOT/11.1-U7


get you stuff:
cd /tmp/mnt/.zfs
.....

Unmount it and restore the mountpoint:
umount freenas-boot/ROOT/11.1-U7
zfs set mountpoint=/ freenas-boot/ROOT/11.1-U7


Maybe there is a more elegant way, but this worked for me.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Have you tried booting into the old boot environment and getting them from there?
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Unmount it and restore the mountpoint:
umount freenas-boot/ROOT/11.1-U7
zfs set mountpoint=/ freenas-boot/ROOT/11.1-U7
Thanks... I got what I needed

For the benefit of other, the unmount statement didn't work for me

#>umount freenas-boot/ROOT/11.1-U7
umount: freenas-boot/ROOT/11.1-U7 : statfs: No such file or directory
umount: freenas-boot/ROOT/11.1-U7 : unknown file system

and I had to use:

umount /tmp/mnt

I also chose to cleanup with:

rmdir /tmp/mnt


Have you tried booting into the old boot environment and getting them from there?
Thanks for the reply...

I was fixated on using the new environment, but I guess there is no reason I couldn't have done that since I haven't updated my pools yet. A month from now when I update my pools, I will have no choice.
 
Top