How can I backup a production image?



  • I know that it should not be necessary to backup a drive image and that restoring the config.xml should rebuild the system, but given that without pfSense I have no internet and my managed switch will loose a lot of functionality I can't afford to take any chances with an update screwing up. (I also don't want to have to pull all the packages and rebuild everything to get back to the pre-update state.)

    Therefore I want to be able so save and restore my pfSense installation using a USB flash drive.

    My pfSense is installed on 120GB SSD (of which less than 6GB is used).

    Here is where I am right now:

    I have written a fresh pfSense install to a good quality 32GB USB flash drive.

    The install created 3 slices and left about 28GB unallocated.

    I successfully created a ZFS volume in that extra slice.

    I can successfully boot the install drive into single user mode, but I can not mount the ZFS volume because the command "zpool import SAVE" fails because / is read only.

    What is the best/safest way to work around this and mount the ZFS volume?

    What is the best way to backup the SSD to a USB flash drive?
    (Using only what comes on the standard install.)


  • Rebel Alliance Developer Netgate

    That's a lot of unnecessary work for no tangible net benefit.

    Just keep the latest installer handy on a USB thumb drive, and keep a backup of your config on the FAT partition of that installer thumb drive. If it breaks, just pop the thumb drive in and reinstall. It will pick up your config automatically.


  • LAYER 8 Global Moderator

    That sure sounds much easier to me ;) heheheh



  • @jimp said in How can I backup a production image?:

    That's a lot of unnecessary work for no tangible net benefit.

    Just keep the latest installer handy on a USB thumb drive, and keep a backup of your config on the FAT partition of that installer thumb drive. If it breaks, just pop the thumb drive in and reinstall. It will pick up your config automatically.

    @johnpoz said in How can I backup a production image?:

    That sure sounds much easier to me ;) heheheh

    Thanks for the reply @jimp / @johnpoz - I agree with you that that is the way things SHOULD work, (and likely will work), but if they don't work I need to be able to get back all the OLD software including OLD plugins until I can regroup and figure out what to do.

    Can someone please offer guidance?


  • Netgate Administrator

    Pretty much the only thing you can do there is boot from something else and image the drive in it's entirety.

    If you plan to do that often it might be easier to run virtualised so you can just snapshot it.

    Steve


  • Rebel Alliance Developer Netgate

    If you are using ZFS, you might be able to use ZFS snapshots and perhaps ZFS send/receive to reach some of those goals. But that's all largely untested from a pfSense perspective.

    If it's that critical, you should be running HA, not worrying about non-standard backup procedures. Then if one messes up you are not under any pressure to fix the other node immediately.



  • @jimp with all due respect what if the update is not compatible with my hardware? What if a needed plugin isn't currently working, I have no way or rolling back. A disk backup allows rollback and provides a high level of certainty that I will have a running system very qucily - either the update that I am attempting or a rollback of the old system.

    Am I missing something?

    @jimp said in How can I backup a production image?:

    That's a lot of unnecessary work for no tangible net benefit.

    Just keep the latest installer handy on a USB thumb drive, and keep a backup of your config on the FAT partition of that installer thumb drive. If it breaks, just pop the thumb drive in and reinstall. It will pick up your config automatically.

    I'm hoping to get there with a ZFS install, boot environments work great on FreeNAS and it is easy to roll back an update unless you do a pool upgrade (which you aren't normally forced to do immediately).

    As for HA, cost is an issue as this is a residential environment. A USB drive and a script is a tiny fraction of the cost of a second machine.

    @jimp said in How can I backup a production image?:

    If you are using ZFS, you might be able to use ZFS snapshots and perhaps ZFS send/receive to reach some of those goals. But that's all largely untested from a pfSense perspective.

    If it's that critical, you should be running HA, not worrying about non-standard backup procedures. Then if one messes up you are not under any pressure to fix the other node immediately.



  • @guardian said in How can I backup a production image?:

    Am I missing something?

    What Ive done in the past is to keep a spare storage device.. Identical to the drive that is in my box.. loaded and ready to go for my site here.

    And a spare box ready to go that I can back up to that is kept for several of my remote sites.

    I would ask- what if during the action of re-imaging a drive you have problems? You could be fighting an unknown for a longer period and possibly not get there. Then how do you ask for help from a community that has not themselves attempted what you are trying to do? And on a production system that people are counting on..

    My first question of my people would be- "why did you choose to take that course of action when the manufacturer recommends another?"

    If your connection is in deed that important.. that you have no down time, then you should have a standby at the very least. And you should already know that the latest installer is going to work on the standby.

    IMHO ☺


  • Netgate Administrator

    Having a recovery plan is pretty much vital even for a home user if you have any sort of reliance on your connection.

    Your points about a newer version being incompatible with your hardware are valid. Though unlikely IMO.

    In a commercial setting I would suggest setting up a test install (preferably on identical hardware) and updating that before doing so on the production equipment. That's impractical for most home users.
    However the cost of small SSDs is relatively low these days. You could get a new SSD swap that out and install 2.5 on it. Restore your config and see what happens. Swapping back to the 2.4.4 SSD is trivial if it doesn't go smoothly.

    Steve



  • @chpalmer, @chpalmer chpalmer thanks for the response:

    @chpalmer said in How can I backup a production image?:

    @guardian said in How can I backup a production image?:

    Am I missing something?

    What Ive done in the past is to keep a spare storage device.. Identical to the drive that is in my box.. loaded and ready to go for my site here.

    I might have to buy another drive and do a fresh install to that drive, but I would rather not have to open the box.

    And a spare box ready to go that I can back up to that is kept for several of my remote sites.
    Great idea, it's simple a matter of economics

    I would ask- what if during the action of re-imaging a drive you have problems? You could be fighting an unknown for a longer period and possibly not get there. Then how do you ask for help from a community that has not themselves attempted what you are trying to do? And on a production system that people are counting on..

    That is a possibility, but nothing is risk free.

    IIUC what I am trying to do should be as simple as:

    1. Boot an install USB into the single user rescue mode
    2. Mount the internal partition
    3. Mounti the ZFS slice on the flash drive
    4. Doing a tar czvf.

    A restore would replace step 4 with

    1. rm -rf on the botched install
    2. tar xzvf

    Is there any reason this should not work?

    My first question of my people would be- "why did you choose to take that course of action when the manufacturer recommends another?"
    The course of action that I am considering is a fallback only. May plan is to run the upgrade first, if it works, job done, If that fails run a new install, if that fails then use the backup.

    If your connection is in deed that important.. that you have no down time, then you should have a standby at the very least. And you should already know that the latest installer is going to work on the standby.

    IMHO ☺
    I agree entirely, economics often rules, especially in a home installation.

    @stephenw10 said in How can I backup a production image?:

    Having a recovery plan is pretty much vital even for a home user if you have any sort of reliance on your connection.

    Agreed

    Your points about a newer version being incompatible with your hardware are valid. Though unlikely IMO.

    In a commercial setting I would suggest setting up a test install (preferably on identical hardware) and updating that before doing so on the production equipment. That's impractical for most home users.
    However the cost of small SSDs is relatively low these days. You could get a new SSD swap that out and install 2.5 on it. Restore your config and see what happens. Swapping back to the 2.4.4 SSD is trivial if it doesn't go smoothly.

    That's what I may be forced to do, but I can't see why what I have outlined above shouldn't work.

    I would certainly work with a linux system (If boot were a separate partition, I would have to make a second tar file for boot). I don't know enough about FreeBSD, but maybe I would need to run some other utility to preserve the boot code.


Log in to reply