I bought a Geekworm NASPi v2.0 case, to house my Raspberry Pi 4 with 8Gb RAM with Raspberry OS installed. This setup will be used for multiple purposes including as a web server running my Piwigo development site for the operational site gallery.fotokruse.eu, which is currently hosted at Antagonist. The Raspberry OS will be installed on a micro SD card and the data on a Samsung 512Gb 2.5″ SATA3 SSD.
Main reason to select this case was the option to have a 2.5″SSD or HDD included inside the case to store the photos for the Piwigo site and other data. My initial preference was a NVME SSD based case, but unfortunately not available in November 2022. The Geekworm NASPi case provides the following functionality:
- Solution based on the latest Raspberry Pi 4
- Supports 2.5-inch sata HDD/SSD
- Build in software safety shutdown function
- Power switch & Auto power on in case power got disrupted
- Using PWM fan to dynamically adjust the speed of the fan according to the temperature of the CPU
- Shell is made of all aluminum alloy
The case has a modular design composed of three parts:
- X823 storage shield
X823 provides 2.5 inch HDD/SSD storage function(UASP supported)
- X-C1 adapter board
X-C1 provides power management, interface adapter, safe shutdown function, auto power on and fan control
- Heat dissipation system
Includes X823-A3 metal fan bracket and 4010 PWM fan.
This article describes:
- Modifying the Geekworm NASPi case to make it possible to attach it to a DIN-rail;
- Installing the Raspberry Pi 4 with 8Gb RAM inside the case
- Installing Raspberry Pi 4 OS on a micro SD card
- Configuring the Geekworm NASPi ventilator and power button.
- Mounting the SSD drive to be used for data storage such as the Piwigo website photos
2. Modifying the Geekworm NASPi case
I modified the Geekworm NASPi case to attach a DIN-rail connection plate. More details will come later.
3. Installing the Raspberry Pi 4 inside the case
More details will come later.
3.1 Configure Auto Power ON
4. Installing Raspberry Pi 4 OS
See the official Raspberry Pi 4 getting started documentation or other sources on the web. Install the 32-bit OS as the 64-bit OS is still in development phase. I used a 128Gb microSD card, which is more than large enough. For sure as I will use a 512 Gb 2.5″ SSD installed inside the Geekworm NASPi case for storage of data such as the images for the Piwigo site.
5. Configuring the NASPi ventilator
The Geekworm NASPi v2.0 has a silent fan with power management, which makes it possible to adjust the fan speed automatically according to the CPU temperature. Out of the box the fan will run at full speed, but by installing a script on your Raspberry Pi 4 it will adjust its speed depending on the CPU temperature.
Perform the following steps to install the script:
- Execute the following commands in the Raspberry Pi 4 Terminal window
12345678910cd ~sudo apt-get updatesudo apt-get -y upgradesudo apt-get -y install i2c-tools python3-smbus python3-rpi.gpiosudo apt-get install -y gitsudo apt-get install -y pigpio python3-pigpiogit clone https://github.com/geekworm-com/x-c1.gitcd x-c1sudo chmod +x *.shsudo bash install.sh
When the installation is completed the following message will be displayed:
123456The installation is complete.Please run 'sudo reboot' to reboot the device.NOTE:1. DON'T modify the name fold: x-c1, or the PWM fan will not work after reboot.2. fan.py is python file to control fan speed according temperature of CPU, you can modify it according your needs.3. PWM fan needs a PWM signal to start working. If fan doesn't work in third-party OS afer reboot only remove the YELLOW wire of fan to let the fan run immediately or contact us: email@example.com.
- Execute the following command:
Python1echo "alias xoff='sudo /usr/local/bin/x-c1-softsd.sh'" >> ~/.bashrc
- Reboot the system
- Test safe shutdown by entering the following command:
The system will shutdown.
- Restart the system by pressing the power button on the Geekwork NASPi case. Initially the fan will run at high speed and should some seconds later switch to low speed.
6. Mounting the SSD drive
The steps in this section are based on the Geekworm WiKi page Properly Mount USB Storage on Raspberry Pi to mount the SSD installed in our Geekworm NASPi case. The main difference is that this article only contains instructions to mount a SSD/HDD (in my case a 2.5″ Samsung SSD) with one ext4 based logical volume.
6.1 Prepare the mount point
- First make a directory in which to mount the USB drive, in my case I used the name ssd512 as I use a 512Gb SSD:
1sudo mkdir /mnt/ssd512
- Make the logged in user the owner of the mounted drive and make its permissions read, write and execute for it. The normal default user iss pi, but in my case it is Pi4ServerAdmin.
12sudo chown -R Pi4ServerAdmin:Pi4ServerAdmin /mnt/ssd512sudo chmod -R 775 /mnt/ssd512
- Set all future permissions for the mount point to pi user and group
12sudo setfacl -Rdm g:Pi4ServerAdmin:rwx /mnt/ssd512sudo setfacl -Rm g:Pi4ServerAdmin:rwx /mnt/ssd512
R is recursive, which means everything under that directory will have the rule applied to it.
d is default, which means for all future items created under that directory, have these rules apply by default. m is needed to add/modify rules.
The first command, is for new items (hence the d), the second command, is for old/existing items under the folder. Hope this helps someone out as this stuff is a bit complicated and not very intuitive.
6.2 Determine the USB hard drive format
- Find out the filesystem of the ssd via:
This command will show something similar like:123456/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="D386-9DE9" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="4a197043-01"/dev/mmcblk0p2: LABEL="rootfs" UUID="996c1b5f-170b-4f38-a5e0-85eef5acf12c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="4a197043-02"/dev/sda5: LABEL="SSD512" UUID="d2f5f452-8014-d901-d0e1-f4528014d901" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="597fdda9-05"/dev/loop0: TYPE="squashfs"/dev/loop1: TYPE="squashfs"/dev/loop2: TYPE="squashfs"
As I had preformatted the SSD on my windows computer with the free Minitool Partition Wizard as a ext4 logical disk with volume label SSD512 I know the drive is linked to /dev/sda5.
- Mount the usb ssd with the following command. The option -o ensures Pi4ServerAdmin is the owner which should avoid permission issues:
1sudo mount -o uid=Pi4ServerAdmin,gid=Pi4ServerAdmin /dev/sda5 /mnt/ssd512
6.3. Automount the USB ssd drive on boot
The /mnt/ssd512 will be the folder in which you store your media. We want it to be automounted on boot .
- The best way to do this is through the UUID. Get the UUID by using this command
1sudo ls -l /dev/disk/by-uuid/
This will show something similar like:
1234total 0lrwxrwxrwx 1 root root 15 Dec 20 15:38 996c1b5f-170b-4f38-a5e0-85eef5acf12c -> ../../mmcblk0p2lrwxrwxrwx 1 root root 10 Dec 20 15:38 d2f5f452-8014-d901-d0e1-f4528014d901 -> ../../sda5lrwxrwxrwx 1 root root 15 Dec 20 15:38 D386-9DE9 -> ../../mmcblk0p1
The UUID you require is the long ID after the date. In my case for the sda5 drive: d2f5f452-8014-d901-d0e1-f4528014d901.
- Edit fstab to mount the USB ssd drive by UUID on boot:
1sudo nano /etc/fstab
In my case the editor is loaded with the following:
- Add a new line at the bottom which has the following syntax:
1UUID=<span style="background-color: #ffff99;">XXXX-XXXX</span> /mnt/<span style="background-color: #ffff99;">ssd512</span> ext4 nofail,defaults 0 0
Replace XXXX-XXXX with your UUID and ssd512 with your mountpoint directory. In my case it becomes:
1UUID=d2f5f452-8014-d901-d0e1-f4528014d901 /mnt/ssd512 ext4 nofail,defaults 0 0
Added in the editor it looks like:
- Save the file (Ctrl-O) and close the editor (Ctrl-X).
- Test the fstab file works by entering the command:
1sudo mount -a
If you didn’t get errors reboot, otherwise try the suggestions on Geekworm USB storage mounting instructions page to get it working then test again with command above until it succeeds.
- Reboot the system:
- You should be able to access the mounted USB drive and list its contents
Every time you reboot, the drives will be mounted as long as the UUID remains the same. If you delete the partitions or format the USB ssd, hard drive or USB stick the UUID changes.
If you have multiple hard drives you will have to make separate mount points (e.g. /mnt/usbstorage2) for each drive’s partition
If required you can setup hard drive spin down times. See the article “Spin down and manage hard drive power on Raspberry Pi“.
Head over to the article “How to install Piwigo on a Raspberry Pi 4?” to install and configure a Piwigo site. In my case the Piwigo website will run on a Raspberry Pi 4 installed in the Geekworm NASPi v2.0 case as setup and configured in this article.