I was thinking about trying out ubuntu on my pi4, and I was wondering if I do a dietpi-backup and save all the created folder as a .tar, and backup that file, can I just format my Sdcard and use it, later on, to restore my system to what it was before?
I noticed there are some symbolic links on that dietpi-backup folder, and since I dont know much about linux, would that process work ? I just dont wanna try it and lose all my configurations I already have in place…
I guess it’s not possible to restore a DietPi backup into an Ubuntu system. Because DietPi is based on Dabian and not Ubuntu.
What you could do is to create backup of your DietPi system directly on a USB stick. This backup could be restored on a new DietPi installation during first initial setup.
As an alternative, create/clone an image directly from your SD card or just use a 2nd SD card.
The Ubuntu image is partitioned the same way with a separate /boot FAT partition, right?
In theory it should work when calling rsync manually (correctly excluding tmpfs mounts like /dev /proc /run etc). Check the dietpi-backup script about how rsync is called. It replaces each and every file so should replace Ubuntu completely with the DietPi system. On RPi there is no bootloader outside of the filesystems, there is also no need to re-flash the bootloader.
But we have seen reports about some strangely changed ELF headers when a Buster backup was restored on a Bullseye system so that suddenly curl failed to run. I’ve not really an idea what mechanism caused this, but obviously there is one. And the same might cause also issues when “restoring” a Debian on a running Ubuntu system.
So while it would be interesting to know whether it works well, I wouldn’t count on it with a production system but follow Joulinar’s advice to restore it onto a fresh DietPi image instead.
Cleaner and generally functional (regardless which platform/device) is btw to create a full disk image/clone from your SD card. There are tools to do this on Windows and macOS. When you have another DietPi system, you can use also dietpi-imager which automatically minimises and 7zips the image to a small size. To have it expanded automatically when booting the restored/flashed image, enable the related service on DietPi first:
systemctl enable dietpi-fs_partition_resize
Or run the script manually on the running system: