1) What you'll need:
- Raspberry Pi 4 Model B 8GB RAM (google search link to buy)
- SanDisk Ultra 32 GB microSDHC Class 10 (Amazon link)
- USB 3.0 Hub with power supply (Amazon Link)
- FLIRC Aluminium Case (Amazon Link)
- USB A to USB C Cable (Amazon Link)
- CAT7 Network LAN cable (Amazon Link)
- 1TB Sandisk Extreme SSD 1050 MB/s read / 1000 MB/s write (Amazon Link)
- A Macbook with a integrated SD card reader or a microSD-USB card reader
- Optionally an Iphone for network discovery
2) Step-by-step setup for your Raspberry Pi 4 Model B
1. Download and install Raspberry Pi Imager (https://www.raspberrypi.com/software/)
2. Format your MicroSD-Card with "Festplattendienstprogramm" also called "Disc Utility" and Format the card with the file system FAT / Master Boot Record settings
3. Start the app, select RASPBERRY PI OS LITE (64-BIT) and select your 32GB SD Card then start the process, configure the installation options to activate SSH, set up your username and (secure!) password, set your Rasp4B device name
4. in the meanwhile unpack and assemble the Rasperry Pi 4 with the Aluminium Case
5. Format your new SANDISK Extreme via the Disc Utility as file system exfat / Master Boot Record and name it "EXTREME"
6. Wire everything except the Raspberry Pi 4 (power USB-hub, Sandisk Extreme to USB-hub with USB A to USB C cable, LAN-cable to router, etc) also insert the MicroSD-Card when the installation process is finished
7. put in the power of your (RaspB4) - even nicer to power it through a homekit-controllable power socket
8. the RaspB4 will now boot und will need a few minutes (just wait around 5 minutes at the first boot until all basic settings are configured automatically, if you happen to own a micro-HDMI cable or adapter, you could even watch the process on a screen, but its not necessary
9. Install web_ssh (link) on OSX (basically just a nicer terminal for SSH connections)
10. Finally we need the IP of your RaspB4 for the first time and there are several options (without looking through a microHDMI-connected display directly in the console on your RaspB4). The easiest option is to install this free app called "Network Analyzer" from the appstore on your Iphone and scan your Network "LAN" - it will resolve the IPs automatically and you'll find your RasbB4 easily by looking out for the name you've set. Second way to get the IP is to start the "terminal" on your OSX device / Macbook, write "arp - a" to display all network devices and resolve the hostname by hand for each IP-adress with the command "nslookup {IP-ADRESS}". this only works if your (wireless-) network DNS is your router (f.e. 192.168.0.1) because every other DNS won't resolve the hostname which will end in an error with nslookup
11. once you've discovered the IP-adress, connect with your credentials (you've set at the installation of your microSD card) via (web_ssh) SSH (see 9) to your RaspB4
12. now let's install everything by typing this:
// updates the system:
sudo apt-get update
sudo apt-get upgrade
// installs exfat compability:
sudo apt-get install exfat-fuse
sudo apt-get install exfat-utils
// list all drives of /dev/ folder:
sudo fdisk -l
// this will result in something like this at the end of the list, look out for your SSD
Disk /dev/sda: 931.48 GiB, 1000171323904 bytes, 1953459617 sectors
Disk model: Extreme 55AE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 1048576 bytes
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/sda1 2048 1953457568 1953455521 931.5G Microsoft basic data
// lists all devices / drives in a nice list to get the right name of your SSD partition:
lsblk -o NAME,LABEL,SIZE,FSTYPE
// mounts your SSD Partition /dev/sda1/ to /media/exfat/
sudo mount /dev/sda1 /media/exfat/
// get a list of all drives with UUIDs
sudo blkid
// one line of the output will look like this
/dev/sda1: LABEL="EXTREME" UUID="XYZ" BLOCK_SIZE="512" TYPE="exfat"
// start the editor for fstab
sudo nano /etc/fstab
// copy this to the last line before the first #, change the UUID to your SSDS /dev/sda1 partitions UUID, copy exactly this syntax!!) and close it with CTRL + X > Y(es) > ENTER.
UUID=XYZ /media/exfat exfat defaults,auto,umask=000,users,rw 0 0
// mount everything, no output if everything works
sudo mount -a
// reboot your RaspB4
sudo reboot
// wait until the SSH connection will work again (reboot needs around 20-40sec) and reconnect
// show mounts
lsblk
// should display something like this
└─sda1 8:1 0 931.5G 0 part /media/exfat
// set read/write rights for the /media/exfat folder
sudo chmod -R 0755 /media/exfat
// install samba
sudo apt install samba samba-common-bin
// start editor for samba.conf
sudo nano /etc/samba/smb.conf
// paste this at the bottom of the file, change the path to your set path f.e. /media/exfat and close it with CTRL + X > Y(es) > ENTER.
[raspberry]
comment = Raspberry Pi
path = /media/exfat/
valid users = @users
force group = users
create mask = 0775
directory mask = 0775
read only = no
// define the user and a (secure!) password for your SAMBA service
sudo smbpasswd -a {NEW_SAMBA_USERNAME} > ENTER
{NEW_PASSWORD} > ENTER > {NEW_PASSWORD_AGAIN} > ENTER
// reboot the system
sudo systemctl reboot
// check your Rasp4B temperature 🙂
vcgencmd measure_temp
13. now you are able to connect with your Macbook (Finder > network - login with username / password) with your SAMBA server, upload and download files and login to it via multiple apps from devices like the AppleTV 4K.
Helpful commands:
How to change the SAMBA password for your user:
sudo smbpasswd -U {YOUR_SAMBA_USERNAME) > Enter your new password twice
How to list all SAMBA users:
sudo pdbedit -L -v
Check your RaspB4's own IP Adress: (source)ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'
Show listening ports and established connections
sudo netstat -plaunt | egrep "ntp|bind|named|samba|?mbd"
Show your own Macs IP in OSX terminal
ifconfig -l | xargs -n1 ipconfig getifaddr
How to check the Speed between your Mac and the RaspB4:
In order to test your speed connection, you need to have two systems with iPerf. One system will bei your server, while the other one will act as a client. Of course, the server and the client can be on the same Raspberry Pi but in our case we want to check the transfer speeds from one to another.
1. On your OSX machine, download IPerf3 64bit 3.1.3 (link) and launch the unpacked directory via the finder as a terminal window by right click "new terminal from folder", the terminal line should say YOUR_USER@YOUR_MAC iperf %
2. Install IPerf3 on your RaspB4 via the WebSSH app (source):
// Update the package lists
sudo apt update
// Install iPerf 3:
sudo apt install -y iperf3
// check version of iPerf:
iperf3 --version
// Start IPerf3 server:
iperf3 -s
3. Now back to your OSX terminal, write this line (it will start as a client (-c) connect with your raspberry doing the test for 10 seconds with 10 parallel streams (source for all IPerf3 commands)
./iperf3 -c {IP_OF_YOUR_RASPB4} -t 10 -P 10
Photocredit: pexels.com/@googledeepmind/
No Comments.