batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
1.98k stars 512 forks source link

Batocera needs an Intel and AMD RAID Driver for RAID Setups #9128

Closed Sleyk2010 closed 1 year ago

Sleyk2010 commented 1 year ago

I am currently testing out RAID setups for Batocera, and I am trying to boot an Intel RAID0 Volume with 2 x 8TB Hard drives, to make a total of 16TB in RAID0.

I make the RAID0 volume using my onboard Intel ports and the built-in motherboard RAID utility, which is fine. But of course, I can't see the RAID volume to install Batocera from within a pre-existing Batocera installation, as Batocera has no way to detect the RAID volume, and only sees a single 8TB drive.

This is because Batocera can't recognize the new RAID volume as it has no RAID drivers..

What I tried to do as a workaround, is install Batocera to a small SSD, then I used G-parted to copy over the boot partition and the share partition to my Intel RAID0 volume. The boot partition being Fat32, and the Share partition being EXT4.

Then once copied, I use G-parted again to expand the share partition that's now on the 16TB RAID0 volume after copying it over, to fill the rest of the unallocated space.

G-Parted allows me to copy the partition and expand the drive, but upon reboot, Batocera doesn't load, and I only get a black screen. It seems that the Batocera boot partition is unable to load itself from a RAID0 setup, which again, is most likely due to the Batocera boot partition not recognizing the RAID0 environment it has now found itself in.

Thus essentially, Batocera needs an Intel and AMD RAID driver, so that Batocera can recognize drives in RAID0, RAID1, etc. and allow it to boot.

What I have tried in testing:

  1. I used GPT partition table - no work.
  2. I used MBR partition table - no work.
  3. I attempted to partition to btrfs to see if I could get the RAID volume recognized in Windows to then copy over the boot partition - but again, no work, and even G-Parted didn't like it and kept complaining.
  4. I formatted the RAID0 volume for 64kb stripe size, and tested it, and then did it for 128kb stripe size, and tested both MBR and GPT partition tables on each stripe size - but sadly for both, no work.

Batocera will only recognize single drives for installation, and will not see the RAID volume on the onboard ports, no matter what. This is why Batocera needs a RAID storage driver. We need one built into Batocera for both Intel and AMD storage ports.

The mechanisms are already there, and it shouldn't be too hard to add a driver to recognize RAID volumes in Batocera to boot. Having this functionality will open a world up for people who cannot afford to purchase a larger, more expensive drive, and could instead, RAID0 their smaller drives, giving them a slight speed advantage, as well as extra storage space.

Or perhaps, if they were so inclined, they could RAID1 their drives as well, giving them a bit of protection against a failed drive, so that they wouldn't immediately lose their hard work and setups if a drive fails.

Further, this can help solve the issue of needing to add more drives to the setup, as you would be able to use RAID functionality, and avoid external drives in an all internal setup.

And yes I know, RAID0/1 is risky to an extent, but for gaming and for the capacity it can bring, it is worth it for those who want to use it.

Please add an Intel and AMD RAID driver to Batocera so it can recognize on-board RAID volumes please!

taleteller commented 1 year ago

Onboard raid "controllers" are a bit tricky and generally not suggested to be used with linux at all. However I notice that mdadm is part of the batocera stack. And if its working as intend I would suggest to try the following:

  1. Do not try to get your boot device onto the raid/md, there is not much to win for the hassle. Using a system ssd is what you would do on a NAS as well. Its faster, easy to replace and since Batocera is built on a read only file system you wont lose anything if it breaks. Install the harddisks you want to build the raid as well.
  2. Break any existing raids from mainboard side, just plain disks. No bother to format anything.
  3. Never use RAID0, its bad, always. RAID1 is OK, RAID 10 is OK, RAID 5/6 takes too much cpu to worth the spared disk.
  4. Get the base system installed onto the ssd and ensure you can start the system.
  5. SSH into your batocera system. The required tool is installed on any linux or modern windows system. On windows I suggest to start the ssh console from within a powershell window.
  6. Build your raid using mdadm, sgdisk and blkid. There are howtos all over the internet like this one.
  7. About formatting I suggest ext4, thats what batocera is using for the common SHARE. The tool mkfs.ext4 is available as well.
  8. After assembling the md device I am pretty certain you have to persist the changes to the configuration using batocera-save-overlay otherwise it wont survive the boot and you would have to rediscover the assembly by hand.

Mounting the raid could be the tricky part. Where regular harddisk will show up like /dev/sda2 this will show up as /dev/md0. I have no idea if batocera takes those into consideration where you select a target for the userdata. Might be you have to modify /etc/fstab.

A cleaner way of combining your Batocera with a huge storage is to separate the storage into a separate NAS system over network. There are prebuild boxes from Synology or QNAP. There is also the possibility of using a custom system with FreeNAS. Its the way I choose for my home system, all systems share a server. FreeNAS gives you the benefits of ZFS, a filesystem that makes regular RAIDs look like retro tech. Its also way less of command line action, since most of it works out of the box or via browser interface.

dmanlfc commented 1 year ago

Closing, GitHub issues is for bugs not feature / functionality requests. @taleteller provided some excellent advice.