Create custom initramfs with cryptsetup and dd

I would like to create a custom initramfs with cryptsetup and dd for easy backup creation and restore without the need for an usb stick.

I imagine with such an initramfs available through the boot manager, it should be possible to create a full dd clone of the system disk onto a secondary disk. The Backup disk is larger than the system disk and is also encrypted. Hence, I need cryptsetup to open the backup disk.
Also, it should be possible to restore the system disk using dd. Since everything is loaded to memory, it should not interfere with the dd restore process.

But I have no clue where to start.

Any Ideas?

Are you using dracut or mkinitcpio?

dracut

Try creating a file /etc/dracut.conf.d/crypt.conf with add_dracutmodules+=" crypt " as the content and see if that adds cryptsetup.

You can check with lsinitrd

If you install the the package busybox, that will probably add dd support next time your rebuild the boot image.

1 Like

Thank you, I will try that :slight_smile:

1 Like