Install/move DietPi on RAID

Hi all!
I want to use my old laptop for DietPi. Laptop has two 500Gb HDD, and i want to use them in RAID. I tried to install pure Debian 11, and it works! The md partitions is /boot and / in RAID1 and /home RAID0. Can i use the same(or similar) partition structure for DietPi? I am asking because it seems that DietPi installing not like Debian, looks like it “extracting” image to disk with whole formatting. There is an article “Moving a running DietPi system to a USB stick/disk or an onboard eMMC” in blog, can i install DietPi on USB and then just dd in to my RAID?


Yes, that’s a typical behaviour if you flash an entire image to disc. This will overwrite existing partitions.

If you already have a plain Debian system running, you could try our install script as described on our online docs Supported hardware - Docs Usually this should preserve your partition setup. Just give it a try.

Ooops, seems i’m to hurry to switch to testing branch :slight_smile:
Should i begin from the start and follow script recommendations?

yes would be best as starting point.

after i select “Native PC” installer failed: “unable to flash bootloader: The boot drive does not contain a partition table. Aborting…”
maybe installer does not see md partitions?

Ahh I guess our installer is going to remove the mdadm package that is needed to use the md0 raid drive. :thinking:

So, that mean i could`nt use md raid with DietPi at all? Or there is a plan B?

can you check what options we have to preserve a mdadm raid during install.

Not a trivial one I think, also AFAIK drive manager does not handle it correctly, but @StephanStS will know best.

In the installer we can check whether the root filesystem is on md partition to leave the package installed at least, but AFAIK /etc/fstab is still created wrong and requires a rework as well for RAID partitions. I’m just not sure whether the effort is worth it or whether we should instead follow a long term plan to not recreate /etc/fstab completely but only entries for those drives which are added/changed.

Hi @kar1kam11, can you explain, what this means? Does this mean that you have two HDDs, the first is called RAID1 and contains /boot and /, the second is called RAID0 and contains /home?
In this case you would not have a real RAID system.
Or do you want to put both HDDs together into one RAID (/dev/md0) and merge your /, /boot and /home together on the resulting RAID system?

BTW: I often read “Never boot from a RAID disk”. The reason for that is, if your RAID fails you cannot boot anymore.

two 500Gb HDD’s
on both 3 partitions (1Gb + 100Gb + 350Gb)
/boot(1Gb) and /root(100Gb) – mirror (for redundancy) md0
/home(350Gb + 350Gb = 700Gb) – stripe(for more space) md1
this is just for example, size of partitions may vary, and stripe not necessarily for /home
as tutorials in google say’s – grub should not be installed directly in md0, but on /dev/sda AND /dev/sdb instead

So, does this mean that there is no “Plan B”? And cloning DietPi from USB to Raid won’t work? I mean that i tried to google and doesn’t found any solution, seems no one use Raid in DietPi.
Don’t get me wrong, but if it takes much time to implement raid support in DietPi, and only me would use it, maybe it’s better for me to switch to another distro? Like Ubuntu server + cockpit + porteiner, etc.

Yeah, far easier would be to run the OS from a normal disc and just have data moved to the raid :roll_eyes:

BTW: is this a software raid or managed by the laptop/hardware?

You mean install DietPi to USB, then boot from another live USB, create partitions and raid on HDD’s, and then ‘dd’ partitions from DietPi USB to raid on HDD’s ?

software raid
laptop has option like “Intel matrix raid”, but this is “fake” raid

currently we are discussing your setup on a phone conference :wink:

We are wondering, what you planning to use /home for? Because on DietPi we don’t use it. We try to have data stored on /mnt/dietpi_userdata/ as much as possible. And this one could be moved to a fresh raid after system has finished initial setup completely.

As well what should be the benefit of having /boot and /root split into different partitions? At the end, they are located on same physical disk as well as on same md0 raid drive?


Ok ok, /home is for example, let it be ‘/data’ or whatever. The main idea is one partition(350+350=700) for storing some unnecessarily files. Yes, i know, i can use LVM, but i decide to use stripe raid, because why not :slight_smile:

If i understand correct, grub can’t be installed on raid partition, the OS won’t boot. So, as tutorial say, on the last step debian installation, i should install grub on /boot partitions on BOTH physical disks, not on md raid.

ahh /boot is not part of the raid, while /root is md0 and rest should go to md1 (data)

yep, something like this
/boot partition, but not a part of raid (I misspoke earlier, sorry.)
/root partition - part of the mirror raid
/another_partition - part of the stripe raid, for storing some data (for SMB share, etc)
This work’s with Debian installation, and not with DietPi. I want to find easy solution to fix this, but i can’t figure how :frowning:

yeah, the dietpi-installer is simply going to remove the mdadm package. Actually, our developer is working on an update for the installer to actively check for disk type raid and if detected to keep mdadm package installed

Could be tested with installer from dev branch: v8.11 · MichaIng/DietPi@6184eeb · GitHub
dietpi-drive_manager should not break the /etc/fstab as I thought first.

That’s great! I will wait for an update, hope it will be useful to someone else except me.