4 minutes
Banana Pi installation
Banana Pi in 2024?
Recently I needed a quick and easy way to mount an external disk with an ntfs file system and share it to the network.
So whatcha gonna do? Connect it to a server, mount it, create a samba share for it - done.
So I thought of my long forgotten Banana Pi M1 as it would an absolutely perfect little machine for the job. I am planning to turn it off most of the time, boot it up by wake-on-lan and auto-mount and share the external disk, which automatically goes into standby when nothing is happening with it. The perfect scenario.
So let’s check out how it goes.
OS installation
First things first, I did not remember any credentials for the definitely too old Debian 9 on there, so I had to install Debian. Here is a quick little guide taken from johang.se for a pre-built installation for Debian Bookworm:
wget https://dl.sd-card-images.johang.se/boots/2024-04-01/boot-banana_pi_m1.bin.gz \
wget https://dl.sd-card-images.johang.se/debians/2024-04-22/debian-bookworm-armhf-phie9x.bin.gz \
zcat boot-banana_pi_m1.bin.gz debian-bookworm-armhf-phie9x.bin.gz > sd-card.img
# on macOS you may use instead of zcat...
gunzip -c boot-banana_pi_m1.bin.gz debian-bookworm-armhf-phie9x.bin.gz > sd-card.img
dd if=sd-card.img of=/dev/disk4
default password: phie9x
-> As always, you want to change disk4 for your /dev/sdX volume (or /dev/diskX on macOS) you want to flash to.
First boot
Since the root password is pre-configured, we need to change that. And if you like, even before that, change your keyboard layout accordingly.
wget https://mirrors.edge.kernel.org/pub/linux/utils/kbd/kbd-2.5.1.tar.gz -O /tmp/kbd-2.5.1.tar.gz \
cd /tmp/ && tar xzf kbd-2.5.1.tar.gz \
mkdir /usr/share/keymaps \
cp -Rp /tmp/kbd-2.5.1/data/keymaps/* /usr/share/keymaps/ \
localectl list-keymaps \
localectl set-keymap de
apt-get install console-common
and finally
passwd
and create any user(add -m) you need.
Next change apt sources to include contrib, non-free and non-free-firmware:
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
and update
apt update -y && apt upgrade -y &&\
apt install curl wget htop vim git zsh samba samba-common ntfs-3g [...]# and whatever you might need
install sudo and add your user to it
apt install -y sudo &&\
usermod -aG sudo {USER}
I additionally added a user (and group) called “backupuser” who will be able to mount (and read/write) and rsync files over SSH to my external disk.
This will not be a topic here, you may handle files and remote connections to your liking.
I wanted to write this here because the user actually appears inside fstab later on.
Install some stuff
It is talking long, but it is working ¯_(ツ)_/¯
sudo apt update -y &&\
sudo apt upgrade -y &&\
sudo apt install -y vim nvim htop zsh wget curl rsync git git-lfs ssh &&\
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
and alias vim="nvim" >> ~/.zshrc
¯_(ツ)_/¯
Auto-Mounting
Edit fstab: vim /etc/fstab
like so:
UUID=aada417f-f8d4-4abd-80b0-765e2f990a0e /media/EXDISK ext4 defaults,auto,nofail,user=backupuser 0 0
so that our external disk is being mounted right after boot.
Finishing touches
…would be to create some rsync scripts to copy my files from another server to this external disk.
rsync -rlDz -e "ssh - ~/.id" --progress user@someserver.internal.domain:/mnt/PATH/TO/FILES /media/EXDISK/
Where I would usually recommend options rtlDvz
so that times are being syncted as well, and I would add --delete
to mirror files completely, removing existing non-in-sync files on the external disk.
Conclusion
This worked as smoothly as hoped!
The first steps were the hardest, finding OS imags for the SD card to flash is getting harder by the day.
In some years this will be impossible, rending this little machine useless, unfortunately.
Following the initial installation (flashing the image to the SD card) I experienced this little single-core machine to be pretty slow but with a bit of patience and depending on the expected workload, of course, this would be an absolutely acceptable file-copy machine.