This article will describe a process on how to restore pfsense configuration backup from console using USB drive.
In this tutorial you will learn:
- How to identify USB drive on pfsense system
- How to mount USB drive/stick
- How to restore pfsense backup
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | pfsense FreeBSD firewall |
Software | N/A |
Other | Privileged access to your pfsense system, configuration backup file and USB drive/stick |
Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Restore pfsense configuration backup from console using USB drive step by step instructions
In this article we assume that you already have USB drive/stick formatted asFAT32
:
Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 30523391 30521344 14.6G b W95 FAT32and that you have already placed the pfsense configuration backup file on the USB drive. Example:
$ ls config-FIREWALL.localdomain-20190906160320.xml
-
- Mount USB drive on pfsense system.
Insert the USB drive into the pfsense system’s USB slot. Once ready, access pfsense shell ( option 8) Shell ) either by directly log in into your pfsense console or via remote SSH connection. Next, usecamcontrol
wiithdevlist
argiment to locate your USB drive. Example:# camcontrol devlist <SanDisk SSD U100 16GB 10.56.00> at scbus0 target 0 lun 0 (ada0,pass0) <PLDS DVD-RW DH16AFSH DL31> at scbus1 target 0 lun 0 (cd0,pass1) <Generic STORAGE DEVICE 9843> at scbus2 target 0 lun 0 (da0,pass2) <Sony Storage Media 0100> at scbus3 target 0 lun 0 (pass3,da1)
In the case above our USB disk storage device can be accesses vile
- Mount USB drive on pfsense system.
da1
-
- block device name. Next, execute the
ls
command
-
- to list all available partitions:
% ls /dev/da1* /dev/da1 /dev/da1s
-
- In this case our USB drive has only a single partition which can be accessed via
/dev/da1s
-
- block device name. This is also the partition where the actual pfsense configuration backup file is stored.
-
- Mount USB drive
Use themount_msdosfs
command to mount your USB drive into the/media/usb
directory:# mount_msdosfs /dev/da1s1 /media/usb
Confirm that the USB drive is now mounted and you can access the pfsense configuration backup file:% ls /media/usb config-FIREWALL.localdomain-20190906160320.xml
- Mount USB drive
- Set configuration backup restore
Overwrite the existing configuration file with the backup configuration file on your USB drive. Your configuration backup file name will be different hence adjust the below command accordingly:# cp /media/usb/config-FIREWALL.localdomain-20190906160320.xml /cf/conf/config.xml
and remove the existing configuration cache file:# rm /tmp/config.cache
- Reboot the pfsense system
Almost done. All what remains is to reboot the pfsense system to trigger the backup restore and boot to a new configuration.