4

Raspberry Pi OS now has SATA support built-in

 2 years ago
source link: https://www.jeffgeerling.com/blog/2021/raspberry-pi-os-now-has-sata-support-built
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Raspberry Pi OS now has SATA support built-in

July 30, 2021

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. 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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK