Raspberry Pi 4 as a NAS

Last Modified: Thu, 27 Jan 2022 11:28:13 +0000 ; Created: Thu, 27 Aug 2020 20:58:09 +0000

I recently acquired a Raspberry Pi 4 B with 8GB of RAM. In a test benchmark setup I was able to saturate the gigabit wired link with a file transfer between a Windows 10 client and the Raspberry Pi.
READ
970mbps
113 MB/S user-data read after CIFS/SMB/TCP overhead

WRITE
972mbps
113 M/S user-data write after CIFS/SMB/TCP overhead

I am using a 64GB microSD card (class U1) for the OS install, but not the NAS storage. I also installed 5 heatsinks on the Pi and used a case with a small 5V fan. Connection is via a gigabit switch between the client and the Pi. I have the latest Raspberry Pi OS lite 64-bit. My testing used a ramdisk so the microSD card was not a bottleneck.

Commands used for the setup:

mkdir /mnt/ramdisk/

chmod 1777 /mnt/ramdisk/

mount -t tmpfs -o size=1g tmpfs /mnt/ramdisk/

dd if=/dev/urandom of=/mnt/ramdisk/random.data bs=10M count=100 status=progress

apt-get install -y samba samba-common-bin

apt-get install -y vim

smbpasswd -a pi

vim /etc/samba/smb.conf

systemctl restart smbd
smb.conf
[share]
Comment = Pi shared folder
Path = /mnt/ramdisk
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes