(Cross-posted on Stack Exchange, where I'll post an answer if I get one.)
I've built a Debian rootfs for an embedded Linux platform using debootstrap et al. My goal is to make this installable to my devices over the network.
I previously built my own solution using iPXE but I'm evaluating switching to Clonezilla. However, I am not cloning an existing drive; I want to make the restorable image from my rootfs directory, and populate the necessary metadata fields about the partitions for Clonezilla to recreate on restore.
What is the process for "manually" creating a Clonezilla restore image? E.g., should I create a disk image with mkfs && mount -o loop and then clone it? Is there some incantation of partclone that supports this?
(A process that doesn't require root and/or that works inside a Docker container would be preferred, since that's easier to deploy via CI.)
Bonus question for this forum: Which of the network install products is appropriate for this use case? I have a small number of embedded systems being flashed by an operator, sometimes in the field. I'm planning on setting a GRUB menu item that does the network boot and performs a hands-free installation.
Last edit: Ryan Govostes 2024-11-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
" Creating a restorable image from a rootfs directory?" -> Actually this is not clear to me. What's the purpose? Please describe more so that we can provide some info for you.
Steven
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Deploying a custom Linux operating system for an embedded device, such as a Raspberry Pi, generally involves three main phases:
Create the root filesystem (rootfs): Set up a new Linux directory structure (e.g., /bin, /lib, /etc, ...) from scratch. Install the necessary system libraries, binaries, and configuration files required for the device to function.
Generate a flashable image: After preparing the rootfs, bundle it into a single binary file (“image”) that can be written (flashed) onto the embedded device’s storage media (such as an SD card.) The rootfs directory structure is typically encapsulated within a filesystem (e.g., squashfs), according to the requirements of the device’s bootloader.
Flash the image to the device: Directly write the entire image file onto the storage media in a way that allows the device to read and boot from it.
I am currently achieving #1 by using debootstrap which is a Debian utility for producing a Debian-based rootfs from scratch. At the end of this process I end up with a directory structure like ~/new-rootfs/sbin/init etc. — it is not ready to be installed directly to a new device.
I am wondering if I can use the Clonezilla ecosystem to achieve #2 and #3:
Generate a flashable image: Somehow turn the rootfs directory into a "backup" that Clonezilla could restore to a hard drive, producing a filesystem containing all of the rootfs files (/sbin/init etc.).
Flash the image to the device: Use PXE network boot to boot Clonezilla Live over the network so that this backup can be restored onto the device's internal SSD.
This idea hinges on the idea that I can turn a rootfs into a "backup" that Clonezilla knows how to restore. There are some metadata files that I might need to create, like information about the partition map. I don't know which files I would have to create to achieve my goal.
Last edit: Ryan Govostes 2024-11-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(Cross-posted on Stack Exchange, where I'll post an answer if I get one.)
I've built a Debian rootfs for an embedded Linux platform using
debootstrap
et al. My goal is to make this installable to my devices over the network.I previously built my own solution using iPXE but I'm evaluating switching to Clonezilla. However, I am not cloning an existing drive; I want to make the restorable image from my rootfs directory, and populate the necessary metadata fields about the partitions for Clonezilla to recreate on restore.
What is the process for "manually" creating a Clonezilla restore image? E.g., should I create a disk image with
mkfs && mount -o loop
and then clone it? Is there some incantation ofpartclone
that supports this?(A process that doesn't require root and/or that works inside a Docker container would be preferred, since that's easier to deploy via CI.)
Bonus question for this forum: Which of the network install products is appropriate for this use case? I have a small number of embedded systems being flashed by an operator, sometimes in the field. I'm planning on setting a GRUB menu item that does the network boot and performs a hands-free installation.
Last edit: Ryan Govostes 2024-11-04
" Creating a restorable image from a rootfs directory?" -> Actually this is not clear to me. What's the purpose? Please describe more so that we can provide some info for you.
Steven
Deploying a custom Linux operating system for an embedded device, such as a Raspberry Pi, generally involves three main phases:
Create the root filesystem (rootfs): Set up a new Linux directory structure (e.g.,
/bin
,/lib
,/etc
, ...) from scratch. Install the necessary system libraries, binaries, and configuration files required for the device to function.Generate a flashable image: After preparing the rootfs, bundle it into a single binary file (“image”) that can be written (flashed) onto the embedded device’s storage media (such as an SD card.) The rootfs directory structure is typically encapsulated within a filesystem (e.g., squashfs), according to the requirements of the device’s bootloader.
Flash the image to the device: Directly write the entire image file onto the storage media in a way that allows the device to read and boot from it.
I am currently achieving #1 by using
debootstrap
which is a Debian utility for producing a Debian-based rootfs from scratch. At the end of this process I end up with a directory structure like~/new-rootfs/sbin/init
etc. — it is not ready to be installed directly to a new device.I am wondering if I can use the Clonezilla ecosystem to achieve #2 and #3:
Generate a flashable image: Somehow turn the rootfs directory into a "backup" that Clonezilla could restore to a hard drive, producing a filesystem containing all of the rootfs files (
/sbin/init
etc.).Flash the image to the device: Use PXE network boot to boot Clonezilla Live over the network so that this backup can be restored onto the device's internal SSD.
This idea hinges on the idea that I can turn a rootfs into a "backup" that Clonezilla knows how to restore. There are some metadata files that I might need to create, like information about the partition map. I don't know which files I would have to create to achieve my goal.
Last edit: Ryan Govostes 2024-11-10
Maybe you can check these:
https://clonezilla.org//fine-print-live-doc.php?path=clonezilla-live/doc/04_Create_Recovery_Clonezilla
and
https://clonezilla.org//fine-print-live-doc.php?path=clonezilla-live/doc/05_Preseed_options_to_do_job_after_booting
Steven