Restore from file
-
Hi All,
I'm sure this has been asked a thousand times but I can't seem to find it anywhere.I have two Netgate units running Pfsense. The second unit is supposed to be a cold spare unit with the same config on it as our live box.
I have a copy of the live config in an xml file and I have the second unit connected via console cable to my PC. Is there a way I can copy the config.xml file to the 2nd unit from a USB stick ? I'm not very good with Linux / UNIX command line I have to admit so if it can be done, could you point me in the direction of a very simple step by step guide?
thanks in advance,
Paul.
-
You can copy via a USB stick, but why not use the backup & restore functions that are already built into pfsense? Under Diagnostics, there is Backup & Restore listed. Use Backup to save the file to your computer and then Restore to put it on the other system. Very easy.
-
@jknott Hi thanks for your reply. The reason for the post is because the second unit isn't configured on a network that I can access without jumping through a few more hoops than I need to. If I can restore the config from an exported file from the primary using a console cable I thought I could make a direct replica of the primary without it appear on the same network.
If it's not possible then I'll have to set something up so I can do as you suggest.
thanks again,.
-
It is possible, but you need to know some BSD commands, including mounting the USB stick. You'll also have to consider what file system is used when you do that. You'll need to use a mount point, such as /mnt, to mount the stick. Then you use the cp command to copy the file. The file you have to copy is /conf/config.xml.
-
@jknott Hi, thanks for the reply, seems that there is a way but either you don't know or you don't want to share.
I would have thought it was quite a simple exercise to simply mount a USB stick and copy the config.xml file but I don't know unix which is where I need the help. Any how hopefully someone might know.thanks for your help.
Paul.
-
@cre8toruk Right, so after a bit of digging around some BSD forums I finally figured it out... and as i suspected it is very simple.
Select option 8. Shell
Mount the USB stick
ls /dev/da* mkdir /media/usb mount_msdosfs /dev/da0 /media/usb cp /conf/config.xml /conf/config.old cp /media/usb/config.xml /conf reboot
Eh voila !
-
It's not that I don't know. I do and have done so in the past and have done it many times in Linux. With *nix it's not like on Windows or Linux with a full desktop where when you plug in the stick a window opens up. You're working with a minimal BSD system, where you have to manually mount the device. This means you have to know the file system the stick is written with, unless it's the default. You also have to know the device ID, which can change, depending on whether another device was plugged in ahead of it. Then you have to use some mount point, /mnt is already there and then once it's mounted you can actually use the cp command to copy. If you know so little about *nix, it's not a trivial task. If you're going to make any changes, such as the LAN IP address, you're going to need some computer to do so. Why not use that computer to copy the file.
-
@jknott Yes I realise that it's not a gui interface I have seen a shell before back in the good old days of DOS 2.2 :-)
I understand what you're saying but you made no suggestions. My previous post where I listed the commands I undertook to do what was necessary was all you needed to suggest.. with the words "something like this maybe..." but never mind I got what I needed to be done, done. Hopefully what I did will help someone else.Thanks again for taking the time to reply.
Paul.
-
You can just use the external config locator. Just boot the backup device will the config on a USB stick and it will pull it in:
https://docs.netgate.com/pfsense/en/latest/backup/restore-during-install.html#restore-using-the-external-configuration-locator-eclSteve
-
@cre8toruk : if you a have a Windows PC somewhere on your pfSense LAN network, check out :https://github.com/KoenZomers/pfSenseBackup
Just set up a daily task that downloads the complete config.xml.
You could retain the last 30 or 60 files (= 2 months)When you need to use your spare pfSense box, fire it up, import the latests backup, and your ok.
No USB drive needed.
Normally, no more need to think about it.
Just, ones in a while, check if the daily backup is made.I'm using this backup tool for years now, and have always the latest 60 days / config.xml locally available.