Where is "configuration file" located

Status
Not open for further replies.

ertank

Explorer
Joined
Sep 16, 2018
Messages
66
Hello,

I have just setup a FreeNAS 11.2-BETA3. My configuration is as below:
Motherboard: AsRock H310M-ITX/ac (ASRH310M-ITXAC)
CPU: Intel Pentium Gold G5400 Desktop Processor 2 Core 3.7GHz LGA1151 300 Series 54W/58W BX80684G5400
RAM: 2 x Kinston HyperX Fury 8GB DDR4 2666Mhz (HX426C16FB2/8)
CASE: SilverStone Technology Premium Mini-ITX / DTX Small Form Factor NAS Computer Case, Black (DS380B)
PSU: Silverstone ST450W 80+ Bronze (could not find exact part link. Here is closest one I could locate)
POOL DISCS: 4 x WD Red 1TB NAS Hard Drive - 5400 RPM Class, SATA 6 Gb/s, 64 MB Cache, 3.5" - WD10EFRX
BOOT DISC: 8GB No-Name USB Flash drive

Pool is set as RaidZ2. No jails, no VMs. Simple windows file sharing. I have no problems so far and system is up and running.

I am well aware that motherboard and RAM is not suggested. SuperMicro motherboards are not available here in Turkey, and ordering them on Amazon or any other shop will at least double cost on them due to local customs. I had to take that path for starters. I did more than a week time test on RAMs and CPU and HDD burning. I will be backing up my data on a remote media.

One other thing I also would like to backup is my configuration file. However, I could not find where that configuration file is. There are a lot of threads mentioning that people backup it nightly for easier and faster restore from a failed USB for example. My read on documentation does not indicate any location or method to save that file.

My questions are:
1- Where is "configuration file" on my system?
2- How can I backup that file?

Thanks & regards,
Ertan
 

Andy C

Explorer
Joined
Feb 18, 2015
Messages
67
I use a simple shell script executed by cron.

Code:
#!/bin/bash

DB_FILE=/data/freenas-v1.db
BACKUP_DIR=/mnt/zpool/Backups

rsync -v $DB_FILE $BACKUP_DIR
 

Andy C

Explorer
Joined
Feb 18, 2015
Messages
67
FreeNAS® automatically backs up the configuration database to the system dataset every morning at 3:45

Is this documentation correct for 11.1-U6 ? My system data pool resides on '/mnt/zpool' and I see no files created (that might resemble the configuration database) there created at 03:45. Where precisely are these backups stored and how are they named (timestamped, archived) ? Neat feature but woefully described. I think I prefer my solution...
 

Andy C

Explorer
Joined
Feb 18, 2015
Messages
67
FreeNAS® automatically backs up the configuration database to the system dataset every morning at 3:45

Is this documentation correct for 11.1-U6 ? My system data pool resides on '/mnt/zpool' and I see no files created (that might resemble the configuration database) there created at 03:45. Where precisely are these backups stored and how are they named (timestamped, archived) ? Neat feature but woefully described. I think I prefer my solution...
Mystery solved

Code:
$ ls -altr /var/db/system/configs-411517dcdf2b43f3a96114fb41a9292c/FreeNAS-11.1-U6\ \(caffd76fa\)/
<snip>
-rw-r-----   1 root  wheel  385024 Sep 23 03:45 20180923.db
-rw-r-----   1 root  wheel  385024 Sep 24 03:45 20180924.db
-rw-r-----   1 root  wheel  385024 Sep 25 03:45 20180925.db
drwxr-xr-x   2 root  wheel	  35 Sep 26 03:45 .
-rw-r-----   1 root  wheel  385024 Sep 26 03:45 20180926.db

So it seems that it's a bug is that FreeNAS uses /var/db/system/... instead of the configured system dataset ?
 

Andy C

Explorer
Joined
Feb 18, 2015
Messages
67
So it seems that it's a bug is that FreeNAS uses /var/db/system/... instead of the configured system dataset ?

No, no, no. File under 'User error' (again). The system dataset is indeed (transparently) mounted and stored on the configured pool.

Although it was an interesting and educational exercise though, I'm not sure I'm removing my trusted, reliable cron just yet :)

Code:
$ df -h
<snip>
zpool/.system/configs-411517dcdf2b43f3a96114fb41a9292c		   3.9T	 78M	3.9T	 0%	/var/db/system/configs-411517dcdf2b43f3a96114fb41a9292c
 

ertank

Explorer
Joined
Sep 16, 2018
Messages
66
I already read http://doc.freenas.org/11/system.html#system-dataset
Like I said, there is no information about system dataset location on file system to make manual backups. All there is an option to set backup location.

After reading @Andy C posts, I have a mount point as blow:
pool/.system/configs-85575f3640124e06b9ead9eeda4080b1 1.5T 419K 1.5T 0% /var/db/system/configs-85575f3640124e06b9ead9eeda4080b1

I can find files in directory:
/var/db/system/configs-85575f3640124e06b9ead9eeda4080b1/FreeNAS-11.2-BETA3 (85d5c7542)

My new question is:
Assuming my pool is healthy and I got a broken USB. I installed a fresh FreeNAS (same version) on another USB and boot my system. Is it possible for FreeNAS to read and use these already saved configuration files from my regular pool? Can I use them to restore my configuration on this fresh new system?
 

Andy C

Explorer
Joined
Feb 18, 2015
Messages
67
I already read http://doc.freenas.org/11/system.html#system-dataset
Like I said, there is no information about system dataset location on file system to make manual backups. All there is an option to set backup location.

After reading @Andy C posts, I have a mount point as blow:
pool/.system/configs-85575f3640124e06b9ead9eeda4080b1 1.5T 419K 1.5T 0% /var/db/system/configs-85575f3640124e06b9ead9eeda4080b1

I can find files in directory:
/var/db/system/configs-85575f3640124e06b9ead9eeda4080b1/FreeNAS-11.2-BETA3 (85d5c7542)
Is it possible for FreeNAS to read and use these already saved configuration files from my regular pool? Can I use them to restore my configuration on this fresh new system?

Yes. You simply boot, ssh to the server, copy the latest (or the last known valid) version of the saved DB config back to '/data/freenas-v1.db' and reboot.
 

ertank

Explorer
Joined
Sep 16, 2018
Messages
66
Yes. You simply boot, ssh to the server, copy the latest (or the last known valid) version of the saved DB config back to '/data/freenas-v1.db' and reboot.
What I understand is that I can do following: I simply reach my box using a ssh, change to that directory /var/db/system/configs-85575f3640124e06b9ead9eeda4080b1/FreeNAS-11.2-BETA3 (85d5c7542) as it would have been auto mounted. Put back last nights configuration file to its original location at /data/freenas-v1.db

In this case there is no need for manual configuration backups.
 

Andy C

Explorer
Joined
Feb 18, 2015
Messages
67
What I understand is that I can do following: I simply reach my box using a ssh, change to that directory /var/db/system/configs-85575f3640124e06b9ead9eeda4080b1/FreeNAS-11.2-BETA3 (85d5c7542) as it would have been auto mounted. Put back last nights configuration file to its original location at /data/freenas-v1.db

In this case there is no need for manual configuration backups.

Indeed. But as the DB configuration is so crucial, belt and braces isn't a bad thing. And, as the presence of this thread hints, the builtin FN solution isn't entirely obvious to an ordinary user.

I also take another manual backup prior to any major upgrade or jumping between trains.
 
Status
Not open for further replies.
Top