65

I would like to use my Raspberry Pi as a file server (NAS/SMB).

Will I be able to attach a SATA/RAID controller?

Jivings
  • 22,538
  • 11
  • 90
  • 139
Alex L
  • 7,605
  • 12
  • 42
  • 53

5 Answers5

41

You can build a NAS using...

  1. USB Hub
  2. Sata <> USB
  3. SATA Replicator / SATA Hardware Port Multiplier

    • This is how you can chain the multipliers to RAID, RAID'ed RAID's. You can go 4 multipliers deep and choose from a few raid options. At the Start of the Chain where the blue arrow is your combined terabytes of storage, redundant in the way you configured it to be.

    enter image description here

    • This is the standard usage, where you can plug 5 hard drives and RAID them in a certain way, then connect that as a physical drive in 1 SATA port or USB SATA Interface.

enter image description here

You just have to connect the Blue arrow to a SATA to USB converter. As long as you run at USB 2 speeds throughout, you can make quite a mean beefy NAS drive using a Pi.

To power the unit there is a standard plug (good old 1.44" Floppy Drive Connector) It is used in all PC's power supplies for accessories now a days. In this picture is a MOLEX converter. It is the smaller connector. The voltages are:

  • YELLOW - 12V
  • RED - 5V

You need to check how many amps it needs. But if you going to power 5X3.5" Hard drives then a 250Watt power supply will be the best option for powering everything, even the Raspberry from the 5V line!

enter image description here

Good luck :)

-EDIT-

Specifically useful for Raspberry Pi 2+ and a nice alternative to untrustworthy RAID systems.

Instead of using the RAID function on these boards, configure each drive in JBOD and use ZFS to create volumes. ZFS is very stable and guarantees you won't lose a 'bit' of data before it tells the system it's done. Most RAID controllers, like these possibly, usually tell the system the data is written, then flushes data to the drive, which may become corrupt during flush and then absolutely tells nobody, 'dirty' little secrets.. ZFS, firsts writes, verifies and then says everything is OK. Plus, you can always move your drives into a FreeNAS setup and import the volumes easily as if nothing has happened.

Remember though, the bandwidth is limited to USB2 speeds.

A great speed, and fairly well balanced setup is 4 HDD's setup as 2x2 mirrored. It gives you half the capacity with 1 to 2 redundancy. ie 4 x 1TB gives you 2TB total, but wait... ZFS talks to each drive separately, write speeds of 1 drive (~50mb/s) ... read speed of 2 drives (~100mb)!!!!

A blazing fast combination would be mirror 1 X 4. ie 4 x 1TB gives you 1TB BUT, read speeds of up to 200mb/s!!! Write speeds of 1 drive still.

Glorfindel
  • 620
  • 1
  • 8
  • 15
Piotr Kula
  • 17,307
  • 6
  • 65
  • 104
  • 2
    I'm interested in this design, but I'm not up on current HD technology - what are those raid controllers? Are they standard PCI sata host adaptors? How are they powered? – Stevo Feb 11 '13 at 20:43
  • @Stevo Hi- I updated the answer. The actual device might not need much power. But the hard drives will need a good old power supply. So you can just use that to power everything. 250-350 watt PSU are quite cheap. PS - Thanks for following me on twitter. – Piotr Kula Feb 11 '13 at 23:22
  • I'm not quite sure I understand how one could achieve "200mb/s"... considering the ethernet port is limited to 100 Mbps. – Nathan Osman Aug 28 '15 at 05:43
  • Add a Gigibit USB LAN and you can get ~250Mbps out – Piotr Kula Aug 28 '15 at 06:56
  • 1
    JBOD is short for just a bunch of disks and has NO inbuilt redundancy, so if one of those drives fail, you could be completely hosed. RAID levels 1, 5, 10 etc provide mirroring or striping with parity, so if one drive goes down you don't lose all you data. 5 disks on JBoD means 5X the failure likelyhood ( which in some applications is just fine ) – Adam Tolley Nov 06 '16 at 18:00
10

Since the chip does not have SATA support. Your only option is to connect a SATA HD enclosure through the USB port.

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
  • 1
    Considering the cost of those enclosures vs. the cost of the RasPi, it is probably not worth it. – finnw Jun 16 '12 at 12:54
  • 2
    I was wondering whether this could be done via another chip and SPI/I2C/UART communication, but I couldn't find a suitable chip. – Alex Chamberlain Jun 16 '12 at 14:15
  • 1
    Re: cost of enclosures, I am using a 'dock', which is a stand for an internal hard drive. The 'naked' internal drive than goes into a rubber sleeve. Total cost was $35, plus the drive. – cmc Nov 26 '12 at 03:31
  • Multiple shield boards, such as the X829 for the 4B, now provide SATA support without an HD enclosure. – K7AAY Jun 14 '20 at 18:34
8

If you dare, you can implement PCI-E x1 with six pins: SM_SCL, SM_SDA (go to I2C bus as SMBus signal), PCIE_IRQ (open drain, shared by all cards), PCIE_CLK (Derive into differential signal with external circuitry, shared by all cards), PCIE_Tx (Derive into differential externally, one per channel) and PCIE_Rx (Derive from differential signaling externally, one per channel)

Hardware part us easy, but bit-banging PCI-E protocol can be problematic since not all cards can be slowed down that much.

Maxthon Chan
  • 1,051
  • 7
  • 14
4

To build a custom SATA controller for the GPIO pins would not be a simple job, but may happen, one day. Then the Pi could be used as a NAS.

A NAS device would also be a great solution as the Network port is faster than USB.

  • 2
    That's not what the GPIO was designed for - it is designed for a for very low frequency, non-realtime stuff (in general). – Alex Chamberlain Oct 10 '12 at 17:10
  • 1
    You may find some hacking with GPIO and SATA here http://www.johandraaisma.nl/raspberryproject/ – Igor Dec 20 '12 at 01:01
  • 1
    Although... on the Raspberry Pi, the network port is kind of a subdevice through the usb system so its not necessarily faster. – gontadu Jan 19 '13 at 20:18
4

Raspberry Pi is limited in bandwidth due to the USB ports and Ethernet sharing a single 480mbps USB2 host port.

See:

http://www.mikronauts.com/raspberry-pi/raspberry-pi-2-usb-hard-drive-and-adapter-tests/

http://www.mikronauts.com/raspberry-pi/raspberry-pi-2-nas-experiment-howto/

mikronauts
  • 41
  • 3