Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Restore from file

    Scheduled Pinned Locked Moved General pfSense Questions
    10 Posts 4 Posters 960 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      cre8toruk
      last edited by

      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.

      JKnottJ 1 Reply Last reply Reply Quote 0
      • JKnottJ Offline
        JKnott @cre8toruk
        last edited by

        @cre8toruk

        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.

        PfSense running on Qotom mini PC
        i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
        UniFi AC-Lite access point

        I haven't lost my mind. It's around here...somewhere...

        C 1 Reply Last reply Reply Quote 0
        • C Offline
          cre8toruk @JKnott
          last edited by

          @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,.

          JKnottJ 1 Reply Last reply Reply Quote 0
          • JKnottJ Offline
            JKnott @cre8toruk
            last edited by

            @cre8toruk

            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.

            PfSense running on Qotom mini PC
            i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
            UniFi AC-Lite access point

            I haven't lost my mind. It's around here...somewhere...

            C 1 Reply Last reply Reply Quote 0
            • C Offline
              cre8toruk @JKnott
              last edited by

              @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.

              C JKnottJ 2 Replies Last reply Reply Quote 0
              • C Offline
                cre8toruk @cre8toruk
                last edited by

                @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 !

                1 Reply Last reply Reply Quote 0
                • JKnottJ Offline
                  JKnott @cre8toruk
                  last edited by

                  @cre8toruk

                  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.

                  PfSense running on Qotom mini PC
                  i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                  UniFi AC-Lite access point

                  I haven't lost my mind. It's around here...somewhere...

                  C 1 Reply Last reply Reply Quote 0
                  • C Offline
                    cre8toruk @JKnott
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • stephenw10S Offline
                      stephenw10 Netgate Administrator
                      last edited by

                      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-ecl

                      Steve

                      GertjanG 1 Reply Last reply Reply Quote 0
                      • GertjanG Offline
                        Gertjan @stephenw10
                        last edited by

                        @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.

                        No "help me" PM's please. Use the forum, the community will thank you.
                        Edit : and where are the logs ??

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.