Raspberry Pi OS now has SATA support built-in

After months of testing various SATA cards on the Raspberry Pi Compute Module 4, the default Raspberry Pi OS kernel now includes SATA support out of the box.

SATA card and Samsung SSD with Raspberry Pi Compute Module 4 IO Board

In the past, if you wanted to use SATA hard drives or SSDs and get native SATA speeds, and be able to RAID them together for redundancy or performance, you'd have to recompile the Linux kernel with SATA and AHCI.

Sure you could always use hard drives and SSDs with SATA to USB adapters, but you sacrifice 10-20% of the performance, and can't RAID them together, at least not without some hacks.

There's a video version of this post: SATA support is now built into Raspberry Pi OS!

Recompiling the kernel isn't rocket science, and I even built a cross-compile environment to make it easy. But it is annoying, and takes some time, and you have to keep compiling the kernel if you want to keep your Pi up to date.

But this month, Raspberry Pi OS finally has built-in support for almost all PCI Express SATA adapters. All you have to do is run sudo apt upgrade and you'll have it.

That means anyone with a Compute Module 4 can plug in a SATA card, and plug in hard drives or SSDs, and they should just work, assuming you have power to the drives.

I'm especially excited about this because one of the big motivations for adding support came out of my testing efforts for the Pi PCI Express card website, and the code that added support was in my first ever PR to the Raspberry Pi Linux kernel.

And to think, less than a year ago I had never compiled a Linux kernel before!

Native SATA support means we can use things like OpenMediaVault to build RAID NASes with Raspberry Pis, without having to maintain a custom kernel or do any special setup work.

And my main takeaway is it's not as daunting as I thought to write a patch for the Linux kernel (though to be fair I didn't have to go through the kernel mailing list, since my patch went into the Pi OS forked kernel tree).

And I have to credit the humble Raspberry Pi for getting me to this point—because Pis are cheap and re-imaging them is easy, it's less daunting because I know a mistake won't cost me much.

I think a lot of people used to big hulking desktops and servers don't understand how liberating it is to use a tiny hobby computer like a Pi.

One thing you can't do yet is boot the Pi from a SATA drive (see this issue). You can boot from USB, microSD, eMMC, or even NVMe on the latest Pi OS, but currently the Raspberry Pi bootloader doesn't scan SATA devices for booting. At least not yet.

Comments

Hi Jeff, loving the pi content, keep up the good work, the only reason for the post was the comment on needing hacks to raid usbs, I wasn't aware of that, ignored the common wisdom not to raid usb drives, and just mdadm raided seven 2tb usb drives in raid 6, apart from taking many, many, many hours to build the array, and oddly samba being more performant than nfs it works fine and has done for years, previously on a rock 64, now a pi4, so interested in what hacks I should have used.

I would like to believe this means that some sort of non-USB constricted storage is coming to a future Pi.

Hey Jeff! Given this info, what's the current best solution for getting a PiNAS set up? Should I wait for the Wiretrustee SATA board? I'm getting a bit impatient waiting for their release.

What are the prospects of using such a SATA drive for /swap ing?

Great article but I'm confused on what laptops is better for gaming and for completing my projects

Hi Jeff,

what workaround is necessary for booting SATA-SSD via PCIe-Card?
HW: CM4 Lite, 8GB, WLAN + I/O-Board
ThanX

Unfortunately there's no way to boot directly off SATA devices on any Pi yet. You'd need to still have at least the root partition on a microSD card.

Just wanted to say "Thank You!". Great effort, I will transition from an old laptop with M2/ESATA to a RPi for my data storage needs!

Best regards,
Michael

Not any more. It looks like SATA drives are not supported on the CM4 IO board with a PCIe SATA card on Bookworm. I built an OMV6 (bullseye) NAS using CM4 [https://www.hackster.io/cyberleader3000/nassie-raspberry-pi-home-networ…] and I can't get it working with OMV7 (Bookworm).

There is a good discussion here [https://github.com/raspberrypi/linux/issues/5659] but no complete solution yet.

With the additions to cmdline.txt I can get the CM4 to boot OMV7 with the SATA card, however not if there is a drive connected to it. This is a big limitation for a NAS.

It looks like it is changes to the PiOS 12 kernel that are causing the problem and I can't see how to fix it.