How to clone PFSense?



  • Right, the question is exactly hat the subject says: How to clone PFSense installation?

    Why, I do ask for this?

    • Because I um used to clone several other Linux installations, like, for instance, smoothwall , (using ghost, with some tricks, bout with success) - I tried all the tools I know, and all the tricks I know with PFSense, without success.
    • So, have anyone cloned a PFSense installation with successes? If so, can someone (PLEASE!) point me (if possible) to a step-by-step how-to? (Thanks in advance)

    Why, I do ask for this (reason 2)?
    Because the processes of installing from de CDROM to hard disk takes to munch time, asks to many questions (select keyboard maping, select scream font, do I want do format the disk?, Am I sure?, how do I you want to partition the hard disk… and so on... de command /usr/local/cpdup (during install) takes to much time to complete and some times hangs, ), on the first boot takes do Much time with the message "syncing System time before start-up", the installation of the necessary packages and it's configuration takes to much time too. In resume: it's a long, hard and painful process.

    Why, I do ask for this (reason 3)?
    Because, I have already had, by several times, and I haven’t already had time do investigate more how and why but, I have had my systems (PFSense firewall installation) compromised and/or Misconfigured, and/or whatever else, but the facts are that: some time (weeks) after having all set-up, mysteriously it stops working (for instance: some port’s/services I have opened and tested -> closed (unable to communicate on this port's)), and restoring a previously saved configuration does not work/solves. So I think the solution (for me) should be, after having all set-up and working, clone the working installation, do be able, later on, if necessary, to reuse/reactivate/re… the working installation, previously saved/coloned.

    SO (again), - have anyone cloned a PFSense installation with successes? If so, can someone (PLEASE!) point me to (if possible) to a step-by-step how-to?

    Thanks in advance!



  • I think I have heard somewhere that somebody used acronis successfully.



  • I can't provide detailed instructions, but if you throw something like "cloning disks with dd" into Google you'll get a few thousand hits.

    Roughly:

    1. Put both disks/cards into a single machine
    2. Boot the machine with some form of LiveCD (FreeBSD, Knoppix, whatever)
    3. At a command prompt type "dd if=/dev/source of=/dev/target", replacing source with the device that holds the source disk/card and target with the one you want to write to


  • g4u might work.
    http://www.feyrer.de/g4u/



  • I've done it with m0n0wall on a compact flash card. The same method is likely to work with pfSense since m0n0wall and pfSense have so much in common.

    I used Windows with a USB to IDE adapter or USB drive enclosure. Made the image with rawdisk.exe (BSD/Linux equivalent is dd)
    http://www.stud.uni-hannover.de/~kiszka/RawDisk/

    rawdisk [-r|-w] diskno imagefile
    rawdisk -i diskno

    -r              read from disk
      -w              write to disk
      -i              print disk parameters only
      diskno          number of harddisk to read or write (0 for first disk)
      imagefile      name of the image file

    –-------------------------------------------------
    Create Image of drive 1 Example:

    rawdisk.exe -r 1 example.img

    Used physdiskwrite.exe to determine which disk number to use with rawdisk.
    http://m0n0.ch/wall/physdiskwrite.php

    For storage it is compressed with gzip using software 7zip.org.


    Restore config using physdiskwrite Example:

    physdiskwrite.exe example.img.gz

    physdiskwrite v0.5.1 by Manuel Kasper mk@neon1.netSearching for physical drives...

    Information for \.\PhysicalDrive0:
      Windows:      cyl: 12161
                      tpc: 255
                      spt: 63
      C/H/S:        16383/16/63
      Model:        FUJITSU MHU2100AT
      Serial number:        NQ07T542AGMA
      Firmware rev.: 00000008

    Information for \.\PhysicalDrive1:
      Windows:      cyl: 62
                      tpc: 255
                      spt: 63

    Information for \.\PhysicalDrive2:
    DeviceIoControl() failed on \.\PhysicalDrive2.

    Information for \.\PhysicalDrive3:
    DeviceIoControl() failed on \.\PhysicalDrive3.

    Information for \.\PhysicalDrive4:
    DeviceIoControl() failed on \.\PhysicalDrive4.

    Which disk do you want to write? (0..1) 1
    About to overwrite the contents of disk 1 with new data. Proceed? (y/n) y
    Found compressed image file
    509967360/509967360 bytes written in total


    Be careful using physdiskwrite you want to make sure to choose the right disk./mk@neon1.net



  • acronis does work fine as well



  • @ballerh3:

    g4u might work.
    http://www.feyrer.de/g4u/

    Thank you all the people who answered, for the tips, and for the help.

    Not having time to test all, I stuck on g4u.

    I have not so much tested, but for the first impression, it seams to be to slow, (slower than ghost) and does not resizes partitons. But works, and copied correctly the boot partition, grub loader and it’s settings (ghost fails doing this step).

    Thanks.



  • @bgbearcatfan:

    acronis does work fine as well

    Right!

    This time, I had some spare time to use “acronis”, and have done the work fine as well.
    Better user interface, still slow, about 1H30 to clone a 20G HD.



  • One thing that would be even better is if one was able to clone the Pfsense while it is running. Acronis has a client for linux. But, i dont know how to install it. Anyone that have done this? And successfully cloned the machine?



  • Use ghost 2003 boot cd works very nice! Is a lot faster then acronis! I had errors with acronis and ghost 2003 went very well!
    If you don't have it i can supply you a boot image… for cd.



  • But, I guess that still requiers a reboot of the machine and some downtime for the firewall. I still would like a solution for cloning the machine while running. And, since Acronis does that for windows machines. I thought maybe that would work for PfSense/freebsd too.


Log in to reply