Table of Contents
NASpi
Goal
Providing a NAS for Mac, Linux and Windows based on a Raspberry Pi and Samba.
WEB Interface
WEBmin is very powerful, but sometimes its easier to edit the Samba file directly. ;)
Direct edit is also available in the WEBmin.
Samba
Example share
[Public] path = /mnt/sda1/Public public = yes force group = users user = @users writeable = yes
Mac TimeMachine
Global extra settings
[global] fruit:metadata = stream fruit:posix_rename = yes fruit:model = Xserve fruit:nfs_aces = no fruit:wipe_intentionally_left_blank_rfork = yes fruit:veto_appledouble = no fruit:delete_empty_adfiles = yes
Share example
[TimeMachine] public = yes writeable = yes path = /mnt/sda1/TimeMachine user = @users fruit:time machine = yes
Windows
To enable the Window Explorer to find a Samba Server the wsdd2 package must be installed:
sudo apt install wsdd*
See also: https://github.com/Netgear/wsdd2
Users
The easiest way is to add a user to the RPi with the user mananger and then to Samba:
sudo smbpasswd -a <linuxuser>
RAID 1
Mirror two identical SSD's.
For the basic setup I used this link:
https://kraisnet.de/index.php/de/themen/11-nuetzliches/34-raid-1-auf-raspberry-pi-einrichten
fstab
/dev/md0 /media/cloudraid ext4 defaults,auto,users,rw 0 0
mdadm
Show the raid 1 details:
sudo mdadm --query --detail /dev/md0 /dev/md0: Version : 1.2 Creation Time : Sat Apr 19 11:02:25 2025 Raid Level : raid1 Array Size : 1953382336 (1862.89 GiB 2000.26 GB) Used Dev Size : 1953382336 (1862.89 GiB 2000.26 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Intent Bitmap : Internal Update Time : Sun Apr 20 08:38:14 2025 State : active Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Consistency Policy : bitmap Name : naspi:0 (local to host naspi) UUID : 4bf34efa:443aedd8:c423d0b7:08295b0e Events : 8152 Number Major Minor RaidDevice State 0 8 1 0 active sync /dev/sda1 1 8 17 1 active sync /dev/sdb1
SSMTP
For sending notifications from for example Raid.
https://blog.edmdesigner.com/send-email-from-linux-command-line/
Fan
Install pigpiod
sudo apt install pigpio
Start daemon
sudo systemctl start pigpiod
Autostart deamon
sudo systemctl enable pigpiod
Shell script
Using GPIO4, header pin 7, for the 100Hz PWM.
#!/bin/bash while true do TEMP=$(cat /sys/class/thermal/thermal_zone0/temp) RV=$(pigs pfs 4 100) PWM=0 if (( $TEMP > 45000)) then PWM=75 fi if (( $TEMP > 50000)) then PWM=125 fi if (( $TEMP > 55000)) then PWM=175 fi if (( $TEMP > 60000)) then PWM=225 fi echo temp=$TEMP pwm=$PWM pigs p 4 $PWM sleep 10 done
Startup at reboot
crontab -e
@reboot /home/pi/fan.sh&
Connecting the Fan
FET BS170 connection: ---------------------------------------- 6 (GND) Source 7 (GPIO4) Gate 2 (+5V) Fan red wire Fan black wire to FET Drain A resistor of 47k between GND and FET Gate will shutoff the fan in case the GPIO is in an undefined state.\\
3D
OpenSCAD
Links
- WEBmin: https://webmin.com