SOLVED Can Snapshots Restore File Settings That Were Changed On The Host System?

Pclip0

Cadet
Joined
Mar 12, 2019
Messages
5
Here's my system:

FreeNAS version 11.2 U1
Supermicro X11SSM
4 x 4TB IronWolfe in RAIDZ2
Intel - Xeon E3
Crucial - 16 GB (2 x 8 GB) ECC mem

So I pulled a rookie mistake and accidentally hit enter on an unfinished command while in root when I was SSH'd into the host. I ended up making ownership changes to a lot of files...very bad. I have periodic snapshots running recursively on tank and I have a back ups of my flash drive configs. Will restoring a config back up revert the changes I made to the host files?
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
You could if the data itself have not been modified or added.
If you restore from a snapshot, as in Rolling back, you will be able to restore the files to the stated they were at the time of the snapshot.
You just can't restore the ownership alone, though.
You could run "zfs diff" and see what has been changed and maybe you can reassign ownership manually with the "chown xxx:yyy" type of commands.
 

Pclip0

Cadet
Joined
Mar 12, 2019
Messages
5
You could if the data itself have not been modified or added.
If you restore from a snapshot, as in Rolling back, you will be able to restore the files to the stated they were at the time of the snapshot.
You just can't restore the ownership alone, though.
You could run "zfs diff" and see what has been changed and maybe you can reassign ownership manually with the "chown xxx:yyy" type of commands.

Thanks. I'm going to log in now to try to see if I can find what changed and correct it. So I run just "zfs diff" or are there any arguments that go along withe command?


Update: I found commands showing how to compare snapshots:

zfs list -t snapshot -r <tank/>
#list snapshots

zfs list -r -t snapshot -o name,creation <tank/home>
#list snapshots that were created for a particular file system

zfs diff <tank/home/tim@snap1> <tank/home/tim@snap2>
#identify the differences between two snapshots

Unfortunately, it's not showing what I saw actually change. After I realized what I had done and quickly stopped it, I saw for example, ownership of the /bin directory was changed. I corrected that back to root:wheel but I'm still afraid of what other files were changed and if some files I corrected back to root:wheel actually are owned by something different.
 
Last edited:

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
You could run something like "zpool history" as it should return operations performed since the pool was created. You may want to write the output to a file for better readability. Combined with "zfs diff", you should be able to figure out which folder or dataset have been modified and the state before and after the changes.
 

Pclip0

Cadet
Joined
Mar 12, 2019
Messages
5
You could run something like "zpool history" as it should return operations performed since the pool was created. You may want to write the output to a file for better readability. Combined with "zfs diff", you should be able to figure out which folder or dataset have been modified and the state before and after the changes.

Sadly running "zpool history" didn't really help... When I compared the snapshots, it didn't show the /bin directory which I know was affected.

I think I might be confused...if my snapshots are set to capture recursively on /tank but I made changes to files in / (root) like /bin for example, will rolling back to a previous snapshot even help me? I'm not as concerned with the files under /tank because I checked and all seemed fine. I'm more concerned with the files under /bin as they were affected and I changed them back to root:wheel. I'm just not sure if they all needed to be root:wheel. I can ask it this way...what storage device are the host root files located on? Are they on my mirrored flash drives that hold the config?
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Isn't /bin directory part of your Boot drive?
If so, you should still be able to run "zpool history" on your boot pool.
You could potentially create a new Freenas boot drive as a new installation and mount it and list the folders and permissions. You could also copy the critical config files and copy them to you new boot drive. If you do so, make sure you copy all the required files related to SSH seeds and pool config files. If you can't do most of it, you will have to reasign certifactes and the whatnots. Not necessarely an issue but a shortcoming or anoyance at best.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
If you're really concerned about having had an impact on the boot pool, just back up your config, reinstall and restore the config.

That way your boot pool is as fresh as day one.

I'm assuming that you haven't actually modified any files on the boot pool intentionally.
 

Pclip0

Cadet
Joined
Mar 12, 2019
Messages
5
Isn't /bin directory part of your Boot drive?
If so, you should still be able to run "zpool history" on your boot pool.
You could potentially create a new Freenas boot drive as a new installation and mount it and list the folders and permissions. You could also copy the critical config files and copy them to you new boot drive. If you do so, make sure you copy all the required files related to SSH seeds and pool config files. If you can't do most of it, you will have to reasign certifactes and the whatnots. Not necessarely an issue but a shortcoming or anoyance at best.

Good ideas! I think listing the folders and permissions from a newly created boot drive would be sufficient for me.

If you're really concerned about having had an impact on the boot pool, just back up your config, reinstall and restore the config.

That way your boot pool is as fresh as day one.

I'm assuming that you haven't actually modified any files on the boot pool intentionally.

So restoring the config wouldn't revert the file permissions...okay. Good to know. If I reinstalled, how does that affect my pool? How do I remount it with the new config or would just restoring the config take care of that?
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Good ideas! I think listing the folders and permissions from a newly created boot drive would be sufficient for me.



So restoring the config wouldn't revert the file permissions...okay. Good to know. If I reinstalled, how does that affect my pool? How do I remount it with the new config or would just restoring the config take care of that?
Restoring the config on a new fresh install ( different USB key or SSD, is preferred) and will look as if it was never changed. Everything will be like before except when it comes to certificates. This means you will have to update the SSH keys if you do remote replication over SSH.
 

Pclip0

Cadet
Joined
Mar 12, 2019
Messages
5
Restoring the config on a new fresh install ( different USB key or SSD, is preferred) and will look as if it was never changed. Everything will be like before except when it comes to certificates. This means you will have to update the SSH keys if you do remote replication over SSH.

I was able to install FreeNAS on a VM just to look at the directory permissions and it looks like I'm all set! Thanks guys.
 
Top