OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 22.1 Legacy Series »
  • Create Image of my current installation
« previous next »
  • Print
Pages: [1]

Author Topic: Create Image of my current installation  (Read 1483 times)

peterwkc

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 0
    • View Profile
Create Image of my current installation
« on: July 13, 2022, 12:43:31 am »
Dear all,
I would like to create a image(ISO file) of my current configuration. I know there is configuration restore but the plugins is not installed so i want to create my custom ISO file.
Logged

CGrisamore

  • Newbie
  • *
  • Posts: 24
  • Karma: 1
    • View Profile
Re: Create Image of my current installation
« Reply #1 on: July 13, 2022, 01:32:26 am »
Maybe Clonezilla?
Logged

pmhausen

  • Hero Member
  • *****
  • Posts: 2544
  • Karma: 227
    • View Profile
Re: Create Image of my current installation
« Reply #2 on: July 13, 2022, 06:00:47 am »
An ISO will be difficult but a binary image can be created with regular Unix tools.

Example:

dd if=/dev/ada0 bs=1m | gzip -c | ssh user@some.host 'dd of=/some/place/to/store/opnsense-image-20220713.gz'
Logged
Supermicro A2SDi-4C-HLN4F mainboard and SC101F chassis
16 GB ECC memory
Crucial MX300 275 GB SATA 2.5" plus
Crucial MX300 275 GB SATA M.2 (ZFS mirror)
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

peterwkc

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 0
    • View Profile
Re: Create Image of my current installation
« Reply #3 on: July 13, 2022, 07:11:57 am »
Imm looking into clonezilla now. Thanks. Any idea how to clone the hard disk as ISO file???
« Last Edit: July 13, 2022, 07:19:55 am by peterwkc »
Logged

pmhausen

  • Hero Member
  • *****
  • Posts: 2544
  • Karma: 227
    • View Profile
Re: Create Image of my current installation
« Reply #4 on: July 13, 2022, 09:18:57 am »
That is not possible. An ISO filesystem does not support a 1:1 replication of either a UFS or a ZFS installation. And you want the boot partitions, swap partitions etc. too, because otherwise it's again not a one step restore.

Why don't you use the command I wrote? Restore can be done from a live booted USB medium with a similar one liner.
Logged
Supermicro A2SDi-4C-HLN4F mainboard and SC101F chassis
16 GB ECC memory
Crucial MX300 275 GB SATA 2.5" plus
Crucial MX300 275 GB SATA M.2 (ZFS mirror)
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

peterwkc

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 0
    • View Profile
Re: Create Image of my current installation
« Reply #5 on: July 14, 2022, 08:38:37 am »
Is this command correct?

 if=/dev/ada0 bs=5m | gzip -c of=/some/place/to/store/opnsense-image-20220713.gz'
Logged

peterwkc

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 0
    • View Profile
Re: Create Image of my current installation
« Reply #6 on: July 27, 2022, 02:07:57 am »
Is this command correct?

 if=/dev/ada0 bs=5m | gzip -c of=/some/place/to/store/opnsense-image-20220713.gz'
Logged

pmhausen

  • Hero Member
  • *****
  • Posts: 2544
  • Karma: 227
    • View Profile
Re: Create Image of my current installation
« Reply #7 on: July 27, 2022, 06:47:46 am »
That command is complete nonsense. Compare with my example, please. The tool you use is named "dd" so that goes first on the command line. And of course you need to have a second host where to store the image with ssh access (the "ssh" part of my example) and you need to replace the example directory path with a real path with space to store your image.

My example is complete and syntactically correct. But it needs to be adjusted to your environment.
Logged
Supermicro A2SDi-4C-HLN4F mainboard and SC101F chassis
16 GB ECC memory
Crucial MX300 275 GB SATA 2.5" plus
Crucial MX300 275 GB SATA M.2 (ZFS mirror)
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

peterwkc

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 0
    • View Profile
Re: Create Image of my current installation
« Reply #8 on: July 29, 2022, 08:53:01 am »
Yes, I know of dd command, I don't need ssh access.

dd if=/dev/ada0 bs=1m | gzip -c | of=/some/place/to/store/opnsense-image-20220713.gz'


Logged

pmhausen

  • Hero Member
  • *****
  • Posts: 2544
  • Karma: 227
    • View Profile
Re: Create Image of my current installation
« Reply #9 on: July 29, 2022, 09:17:15 am »
That looks good but for the trailing '

Do you have a USB drive connected? Or how do you plan to save the image without going over SSH?
Logged
Supermicro A2SDi-4C-HLN4F mainboard and SC101F chassis
16 GB ECC memory
Crucial MX300 275 GB SATA 2.5" plus
Crucial MX300 275 GB SATA M.2 (ZFS mirror)
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

peterwkc

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 0
    • View Profile
Re: Create Image of my current installation
« Reply #10 on: August 08, 2022, 09:59:34 am »
I'm using usb drive.
Logged

pmhausen

  • Hero Member
  • *****
  • Posts: 2544
  • Karma: 227
    • View Profile
Re: Create Image of my current installation
« Reply #11 on: August 08, 2022, 11:08:01 am »
Ah ... sorry, it does *not* look good :-)
Code: [Select]
dd if=/dev/ada0 bs=1m | gzip -c | of=/some/place/to/store/opnsense-image-20220713.gz'
                                  ^
                                  |
this is nonsense -----------------+

Correct:
Code: [Select]
dd if=/dev/ada0 bs=1m | gzip -c >/some/place/to/store/opnsense-image-20220713.gz

HTH,
Patrick
Logged
Supermicro A2SDi-4C-HLN4F mainboard and SC101F chassis
16 GB ECC memory
Crucial MX300 275 GB SATA 2.5" plus
Crucial MX300 275 GB SATA M.2 (ZFS mirror)
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

tiermutter

  • Hero Member
  • *****
  • Posts: 512
  • Karma: 28
    • View Profile
Re: Create Image of my current installation
« Reply #12 on: August 24, 2022, 01:27:15 pm »
Hi Patrick,

I tried backup and restore from one VM to another (ZFS with multiple BE). I succesfully saved the uncompressed image to my NAS with
Code: [Select]
dd if=/dev/ada0 bs=32m | ssh user@10.13.12.5 'dd of=/share/CACHEDEV7_DATA/Backup/opnsense-image.img'
For restore I used
Code: [Select]
ssh user@10.13.12.5 'dd if=/share/CACHEDEV7_DATA/Backup/opnsense-image.img' | dd of=/dev/ada0 bs=32mRestore looked fine for the first time, as dd writes 20G (Disk size of the source VM) to the destination VM (running OPNsense live), but trying to boot from disk I only got some errors, e.g. calling
Code: [Select]
ZFS: i/o error - all block copies unavailable
Cant find /boot/zfsloader
Cant find /boot/loader
Cant find /boot/kernel/kernel

What am I missing?
Logged
i am not an expert... just trying to help...

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 22.1 Legacy Series »
  • Create Image of my current installation
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2023 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2