An RPI4 based file server

WobblyHand

H-M Supporter - Diamond Member
H-M Lifetime Diamond Member
Joined
Dec 18, 2019
Messages
6,397
After my laptop of 7 years died without warning in January, I decided that one day I'd make a file server, and backup device. It will be a RAID 1 device, simple to implement and some fault tolerance. The idea is to have two of these, one on site and one off site. Fortunately, in the case of my laptop, it wasn't the disk that died, but that of the power supply on the motherboard. For a while, I managed to "live" running an RPI4, while waiting for my new laptop to arrive. The RPI4 is a tolerable cheap computer, if it is slightly overclocked and booting from a SSD. So I thought it might make a reasonable low power file server.

Many months went by, just trying to figure out what would work, and what computer hardware to use. I acquired the hardware, and assembled most of it. It became quite apparent that it occupied a lot of space and was a great tangle of stuff and cables. So this little project was born. I decided to stack the assemblies vertically to save counter space, and to tie everything down.

The server is composed of plates. The plates are 3.5" x 6" x 1/4" aluminum. On each plate is a "function". The first plate is the RPI4 (Raspberry Pi 4) with a small fan. The second plate is the SSD. The third plate is the USB hub plate. And finally, the last plate is the RAID 1 array, consisting of 2 1TB NVME memories. It took me about a month to design all the plates and brackets, primarily because I had to measure all the existing hardware and figure out how I was going to do all of this. Although it looks simple enough, some of it was a stretch for my abilities. At the moment, I don't have a good idea on how to manage the cables just yet, but somehow that will be taken care of.

Here's the RPI4. It's tied down with 4 long screws through a cheap laminated case. The laminated case has some silicone rubber feet. I haven't fired this up yet, but I'm half expecting a bit of vibration or hum. I may have to use some kind of isolator. The little green board I made has a driver circuit for the fan. The Pi makes a PWM signal proportional to the temperature. So the hotter the CPU is the faster the fan goes. The driver is just a resistor, a transistor and a flyback diode. That way the low powered Pi can drive a 200mA fan. The fan cycles off and on depending on CPU temperature. I have it set to 60C, which is well under the max limit of 85C.
PXL_20210420_143515921.jpg
Next is the SSD plate. On this piece I needed to come up with a spacer, since the SATA connector was thicker than the SSD. Found some 0.093" stock that was close enough. I also made a hold down for the connector that prevents the connector from detaching.
PXL_20210420_143539091.jpgPXL_20210420_143555270.jpg
Next comes the plate for the hubs. At least for my RPI4, it won't boot connected to an active hub. Apparently this is a documented fact on the Raspberry Pi forum, for some brands of active hubs. My work around is to have both an active and passive hub. The SSD is plugged directly into one of the USB3 ports, and the passive hub is connected to the other USB3 port. Then the active hub is plugged into the passive hub. This works, so that's what I have to go with. To accommodate the square edges, I needed to make a mouse ear in the corners of the hold downs. I hogged out the material with a 1/2" roughing mill, about 2mm at a time. Then cleaned up the bumps in the corner. Here's a picture of the right side just before doing that. Initially, I wasn't sure if I would hit the screws with the mill. To drill the mouse ear, I did have to remove the corner screw, as the mill just hit the screw head. I then replaced the screw before hogging out the material. You can see that the mill dropped slightly, or something happened. Not sure why this happens. Kind of frustrating. It's only 0.01mm or so, but it can be seen. Oh well, I'm still pleased with how this one came out. The square bracket which follows, not so much. It's ugly underneath. Yes, I did the square one first, so I learned from it at least... I haven't mounted the active hub yet, but the hole pattern is there. I had to source some very tiny metric screws M2 x 12 from AliExpress to fit the active hub. They are kind of like sheet metal screws. I hope they truly are long enough, if not, I will counterbore the hub plate 3 more mm.
PXL_20210420_143648031.jpgPXL_20210420_132710182.jpgPXL_20210420_143709619.jpg
Finally, the RAID plate, which houses 2 NVME sticks. I made two "H"'s and a cover for this. The notches are 9.98 mm deep and the cases measure 10.00 mm. Nice and snug grip on the cases. The NVME cases are aluminum, and get pretty toasty in use, so I wanted some decent contact with metal. Used a radiused end mill for cutting the H. I'm pretty happy with it.
PXL_20210420_143800103.jpg
What's left to do? I need to make spacers for the plates. I have some 3/8" 1144 that I will cut to length and drill and tap for 8-32. I have a bunch of 8-32 all-thread that I will cut into about 1" sections. Probably go to the hardware store for some rubber feet - hope I can find some little ones. Worst comes to worst, I can get some felt feet with adhesive and glue it to the bottom of the feet.

Oh yeah, and the software. Need to set up the RAID array and to set up a cron job to rsync with all of our active computers we want to back up. Once it is all working, then I get to do it again! But also I need to add in firewalls and security, as one of these servers will be remote. That's going to be interesting - but not a topic for HM. What's nice is the actual machining didn't take all that long. Making the drawings took most of the time.
 
Last edited:
Very interesting project. I'm looking forward to seeing how it all packages together.

I'm a Raspberry Pi noobie/wannabe. I became interested when I found out that the RPi3 and a Protoneer break out board could be used as a code sender in lieu of a Windows PC for a CNC wood router. So far I have an RPi3 and then acquired an RPi4 that came as a PC kit with additional hardware. I also purchased my second Protoneer hat after destroying my first with a soldering goof up ($45 mistake).

Other family priorities have prevented much progress, but I thought I'd start with the PC setup to get a feel for wi-fi access and file transfer, then hopefully move up to getting the Protoneer board functioning for the wood router. Still to order drivers, steppers and leadscrews for that. And build the table too - might be a while...

I would love to build up a RPi based Network Attached Storage, but presently that's beyond my knowledge/capabilities.

Cool project.
 
Just test fit the active hub - as I suspected, the screws are short. I will need to counterbore the holes about 3mm deep. The M2 pan head screw heads measure 0.131", or 0.006" bigger than an 1/8" end mill. Next size up that I have is 3/16". Won't be pretty, but it will be on the underside, so it will be fine. Need to get some metric tooling - but that's another rabbit hole. (More collets, end mills, etc.)
 
Did the counterbores and the active hub is assembled to the hub plate. Disassembled the plate, re-indicated it on the mill and presto - counterbores. Have to say, I just love having a mill. That was so easy. The active hub fits like I meant it. It's a sturdy assembly. Thank goodness for spending a lot of time on the drawings... Knocking on wood, no major blunders yet!
PXL_20210421_000123959.jpgPXL_20210421_000013068.jpg
At some point I am going to have to deal with excess cable lengths. It appears it is possible to take apart the active hub and shorten the cable. Perhaps later.

Next is to make the legs and standoffs. That will be tomorrow's activity.
 
Cool project.

This isn't mine but a photo I snapped at the OpenStack conference a few years back. It's a full OpenStack cloud cluster built from NUC's.

thumbnail.jpeg


John
 
I would love to build up a RPi based Network Attached Storage, but presently that's beyond my knowledge/capabilities.
Perhaps at the moment, but I think an RPi is an excellent platform to learn this stuff. One is starting with a new slate, there's really nothing you can damage. It's not like you are playing with your primary computer. Screw up? Doesn't matter - just try again. And again, if necessary. It may seem intimidating in the beginning, but honestly, it's like learning to machine. Yeah, it's totally different, but it is the same mindset. Find out what works, build on that, and keep on doing harder and more sophisticated things. Setting up a simple nfs system is like a couple of downloads - it is pretty easy.

I'll probably make a third computer, which will become my shop computer. I need something that doesn't take up too much room, is inexpensive, and allows me to check drawings or look up stuff on a larger screen. I won't need the hub, nor the RAID array, just the RPi4 and an SSD. Another project...
 
Minor setback. Tailstock of mini-lathe seems way off. Used a center drill and it created a mountain in the center with a valley around it. The center drill was deflecting. I need to adjust the TS as it appears to be fairly large 0.5mm offset. Think I'll make an adjuster for the tailstock. Should be a plate and a few screws. This tailstock never was quite right. Always had issues with drilling. Guess it was the misalignment. Hopefully I can take out some of the horizontal offset. Strangely, haven't used the tailstock since I installed the ER32 collet chuck. Now that the TIR is less than 0.00025" it's obvious there's a tailstock issue. Have to design something up. Goes off to desk to ponder...
 
Back from that diversion. Made a differential screw tailstock adjuster to address the problem. Just set it up and started back on making spacers for the RPI4 file server again. Gee, it has been so long, I have to search for the list of spacer sizes....

Ahh, found them. Need 4 x 2.5", 4 x 0.85" and 4 x 1.6". This morning completed the 2.5" spacers. Used #29 drill in the tailstock, an 8-32 spiral point tap and an 8-32 bottoming spiral point tap. Boy, spiral point taps are nice.

Will have to go to hardware store to see if I can find some rubber feet, the ones that McMaster had seemed to be so large. I just need something that an 8-32 will go through.
 

Attachments

  • PXL_20210524_154932014.jpg
    PXL_20210524_154932014.jpg
    1.1 MB · Views: 16
Hardware store no longer carries rubber feet, at least the kind that are screwed into something. Was hoping for rubber so there would be some vibration damping. I could glue some felt on some metal feet, but the felt probably won't stop "walking". Have to bite the bullet and buy some online.

Spent the last day finishing off the spacers and little bits of all thread. My goodness, what a boring day. Kept on doing the same thing over and over again... But finally it is all done. Put the mechanical bits together and assembled the tower of doom. Next step is managing the cables. Some of them are a bit unwieldy, but managed to get most of them in place. Sorry about all the clutter, I'll get a better picture tomorrow.
PXL_20210526_011045867.jpg
All of the hardware has been tested previously, (sprawled over my desk) but I have not configured the RAID array. Hope to start working on that part tomorrow. It fires up, and I can log in!
 
Configuring the RAID1 array wasn't all that hard. I just followed setup RAID1 on linux Easier than expected. For a 1TB RAID1 (two 1TB disks) syncing takes a while. One can check on the sync progress using $ cat /proc/mdstat . In my case, I am 57% complete after an hour. Even though I have been writing to the NVME disks for an hour, they are just barely warm due to the massive H block clamps/heatsink. The fan comes on for 30 seconds once every 10 minutes or so.
PXL_20210526_112218121.jpgPXL_20210526_112247870.jpgPXL_20210526_112319234.jpg
The little green board plugged into the RPI4 is a single transistor driver for the fan. The RPI4 I/O cannot directly drive the fan, so I quickly designed a little board with a resistor, a transistor, and a snubbing diode. It plugs onto the GPIO header, which provides power and access to the pin which I have programmed to PWM proportional to the CPU temperature. It goes on when the CPU temperature is over 65C, and goes off when the temperature is less than 60C. The hotter the CPU the greater the duty factor of the PWM signal. Seems to work quite well, and a lot quieter than many of the bang-bang controllers I have seen.
 
Back
Top