{"id":402,"date":"2021-02-09T08:22:37","date_gmt":"2021-02-09T11:22:37","guid":{"rendered":"http:\/\/xaxowareti.com.br\/?p=402"},"modified":"2021-02-09T08:22:41","modified_gmt":"2021-02-09T11:22:41","slug":"restore-pfsense-from-backup-using-the-cli-command-line","status":"publish","type":"post","link":"https:\/\/xaxowareti.com.br\/?p=402","title":{"rendered":"Restore pfSense From Backup Using The CLI (command line)"},"content":{"rendered":"\n<p>When all goes bad and you can\u2019t get to the web interface of your Netgate pfSense, you\u2019ll have no option but to try using the CLI (command line). This happened to me recently and this article explains what i did to recover.<\/p>\n\n\n\n<p>A few worthy points:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The pfSense configuration file (a single file) is stored in \u201c<strong>\/cf\/conf\/config.xml<\/strong>\u201c.<\/li><li>Backup configuration files are stored in \u201c<strong>\/cf\/conf\/backup\/<\/strong>\u201c.<\/li><li>Copying the configuration file from the backup location over the top of the current configuration is effectively the restore process.<\/li><\/ol>\n\n\n\n<p>These are the steps to restore back to a previous state. I\u2019m assuming the system wont boot as normal and therefore \u201csingle user\u201d mode is needed.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Boot the Netgate with the&nbsp;<strong>mini-USB cable connecting the Netgate appliance to your workstation<\/strong>.<\/li><li>Very near the start of the booting process, there\u2019s a prompt to boot with options. Select to boot into \u201c<strong>single user<\/strong>\u201d mode.<\/li><li>When you get a prompt, remount the filesystem into read\/write mode using \u201c<strong>mount -u \/cf\u201d<\/strong>.<\/li><li>Check the filesystem for errors and repair them with \u201c<strong>fsck -yf \/<\/strong>\u201c.<\/li><li>Locate and copy the restore file from the \u201c\/cf\/conf\/backup\/\u201d directory. Go back a few stages (not the latest file) based on the times of the backup files. Copy it with \u201c<strong>cp \/cf\/conf\/backup\/config-1593242670.xml \/cf\/config\/config.xml<\/strong>\u201c.<\/li><li>Remove the file \u201c\/tmp\/config.cache\u201d using \u201c<strong>rm \/tmp\/config.cache<\/strong>\u201c.<\/li><li>Run the command \u201c<strong>\/etc\/rc.reload_all start<\/strong>\u201c.<\/li><li>Reboot using \u201c<strong>reboot<\/strong>\u201c.<\/li><\/ol>\n\n\n\n<p>When the device reboots, it should be back-dated (in terms of the config) to the date of the restore file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When all goes bad and you can\u2019t get to the web interface of your Netgate pfSense, you\u2019ll have no option but to try using the CLI (command line). This happened to me recently and this article explains what i did to recover. A few worthy points: The pfSense configuration file (a single file) is stored [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-sem-categoria"],"_links":{"self":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=402"}],"version-history":[{"count":1,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/402\/revisions"}],"predecessor-version":[{"id":403,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/402\/revisions\/403"}],"wp:attachment":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}