Create Image of my current installation

Started by peterwkc, July 13, 2022, 12:43:31 AM

Previous topic - Next topic
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.


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'
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

July 13, 2022, 07:11:57 AM #3 Last Edit: July 13, 2022, 07:19:55 AM by peterwkc
Imm looking into clonezilla now. Thanks. Any idea how to clone the hard disk as ISO file???

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.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Is this command correct?

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

Is this command correct?

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

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.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

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'



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?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)


Ah ... sorry, it does *not* look good :-)

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


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


HTH,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

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 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 ssh user@10.13.12.5 'dd if=/share/CACHEDEV7_DATA/Backup/opnsense-image.img' | dd of=/dev/ada0 bs=32m
Restore 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

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?
i am not an expert... just trying to help...