FreeBSD Network Backup Thing from Scrap
This document shows how to setup a dedicated backup machine for LAN use, made from bit and pieces most people don't care about these days: a Raspberry Pi 1, a 32MB SD Card, and a 2GB USB key. For the software, we will use FreeBSD and BorgBackup.
Prepare the OS
Why waste a 8GB or 16GB fancy SD Card when you probably have some old SD and USB sticks lying around? Also reading performances on the RPi1 is much better on USB than with the crappy SD reader. Finally, FreeBSD on the RPi1 works great, and very light on resources which is a plus given the limitation of the RPi CPU and RAM.
What needs to be done in a nutshell is to have the mandatory MS-DOS /boot
partition on the 32MB SD card and have the rest of the filesystem on the USB stick.
- Get the FreeBSD RPi1 image (update to latest RPI-B image)
wget https://download.freebsd.org/ftp/releases/arm/armv6/ISO-IMAGES/11.2/FreeBSD-11.2-RELEASE-arm-armv6-RPI-B.img.xz
- Plug USB stick and copy the FreeBSD image to it (adjust
/dev/sdX
)
xzcat FreeBSD-11.2-RELEASE-arm-armv6-RPI-B.img.xz | sudo dd bs=1M of=/dev/sdX status=progress
- Plug the 32MB sdcard and create a W95 FAT32 partition with
fdisk
or something (Hex code b) then format it:
sudo mkfs.vfat /dev/sdY1
- Mount both the USB key's first partition and the SD card partition and copy the boot content from the USB key to the SD card:
sudo mount /dev/sdX1 /media/usb-key sudo mount /dev/sdY1 /media/sd-card sudo cp /media/usb-key/* /media/sd-card/ umount /dev/sdX1 umount /dev/sdY1
Boot FreeBSD and basic system configuration
Booting and ssh'ing
- Insert the SD card and USB key on the RPi1
- Optionally: connect the composite out to something for easier troubleshooting
- Power the RPi1, the booting process will automagically find the USB key and the FreeBSD system partition (that's super nice actually).
- Optionally: if you can't figure out the IP of the RPi1, you can sweep your LAN with:
nmap -sP 192.168.1.0/24
- ssh in the RPi1 (default user is freebsd:freebsd):
ssh freebsd@192.168.1.XXX
Some config
Note: The first time FreeBSD starts, it will expand the filesystem to the full available space of the USB key.
- Change default password for
freebsd
user:
passwd
- Become root with
su
(password is root) - Change default password for
root
user:
passwd