Netboot Raspberry PI from ZFS NAS

Due to the death of my last SD card I thought about putting the openelec stuff onto my ZFS-based NAS. I’ve read some howtos about doing so, so let’s give it a try.

Preparations of the ZFS storage
I’ve just dd’d the openelec image onto another SD card. Let’s take a look at the output of parted -l:

Model: Multiple Card Reader (scsi)
Disk /dev/sdb: 2029MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1049kB 269MB 268MB primary fat16 boot, lba
2 271MB 304MB 33.6MB primary ext4

openelec, by default, does not use a swap partition. However. I think that a swap partition does make sense, hence I’ll need three volumes: system, storage, swap.

just in case I’ll have more than one netboot client

zfs create storage/netboot

system, data and swap will have a blocksize of 4K so I’ll define it at storage/netboot/openelec

zfs create -o recordsize=4K storage/netboot/openelec

fat is not casesensitive, system partition takes 268 MB

zfs create -o quota=268M -o casesensitivity=mixed storage/netboot/openelec/system

8 GB should be enough for the storage part.

zfs create -o quota=8G storage/netboot/openelec/storage

We’ll come back to swap, later. That’s a bit more complicated. I just configured openelec/kodi initially on the SD card using my TV. Took the card back into my notebook and mounted /dev/sdb1 to /mnt. Followed by rsync:

andor mnt # rsync -avze ssh * root@192.168.178.29:/storage/netboot/openelec/system/
root@192.168.178.29’s password:
sending incremental file list
SYSTEM
bootcode.bin
cmdline.txt
config.txt
fixup.dat
kernel.img
start.elf
overlays/
overlays/README.TXT

sent 99,937,557 bytes received 176 bytes 3,634,099.38 bytes/sec
total size is 109,852,992 speedup is 1.10

Then unmounted it and mounted /dev/sdb2 to /mnt and rsync again:

andor mnt # rsync -avze ssh music pictures screenshots tvshows videos root@192.168.178.29:/storage/netboot/openelec/storage/
root@192.168.178.29’s password:
sending incremental file list
music/
pictures/
screenshots/
tvshows/
videos/

sent 133 bytes received 32 bytes 47.14 bytes/sec
total size is 0 speedup is 0.00

Now on the NAS and on the SD card edit config.txt and adjust according to your needs. I am using:

arm_freq=900
core_freq=333
sdram_freq=450
over_voltage=2

# set to ‚force_turbo=1‘ to disable dynamic overclocking (you can lose your warranty!)
force_turbo=0

Now edit cmdline.txt on the NAS and SD card (yeah.. I should have rsync’d later :p)

ip=dhcp boot=NFS=192.168.178.29:/storage/netboot/openelec/system disk=NFS=192.168.178.29:/storage/netboot/openelec/storage

Obviously you need a dhcpd running on your network and you should change the ips according to your own network. The path most likely, too. I assume that you have NFS set up on your ZFS already.. So:

root@janice:~# zfs set sharenfs=“rw=@192.168.178.25/32″ storage/netboot/openelec/system
root@janice:~# zfs set sharenfs=“rw=@192.168.178.25/32″ storage/netboot/openelec/storage

You might change the ip / netmask to match your network. My RPi gets 192.168.178.25.

First try

Well, it did boot. But right after starting or trying to start Kodi, I’ve got a black screen. The solution after trying and trying and trying:

root@janice:~# zfs set sharenfs=“rw=@192.168.178.25/32,no_root_squash,no_all_squash“ storage/netboot/openelec/system
root@janice:~# zfs set sharenfs=“rw=@192.168.178.25/32,no_root_squash,no_all_squash“ storage/netboot/openelec/storage

Voila 🙂

No Comments

Post a Comment