Ubuntu Server Nas
2021-03-13
I bought an HP Microserver to run as a NAS, Homelab and general utility server.
Weird things I’ve learnt and am documenting mostly for myself but if they help anyone else then so much the better.
Networking is disabled by default, you either need to run sudo dhclient to bring up an interface with dhcp or you need to create a netplan config and then run netplan.
My config looked like this:
network:
ethernets:
eno1:
dhcp4: false
addresses: [10.1.1.210/24]
gateway4: 10.1.1.1
nameservers:
addresses: [9.9.9.9, 149.112.112.112]
version: 2
Things to note - check your interface id beforehand. Mine were remapped from ethX to enoX for some reason. Luckily I noticed earlier when I was investigating what was going on.
Secondly the /24 on the addresses block is not a mistake. Even though you’re specifying a single address which would normally be /32 you put the mask for whatver your network range is on the end. In my case I’m using a standard /24 range so /24 goes on the end. I look at a lot of configs thinking they were wrong before I found an explanation mentioned in passing.
ZFS is weird and mdadm is too clever for its own good. The drives I’m using were previously briefly used in a RAID. mdadm detected this and tried to mount them and ZFS was refusing to create the pool as they were in use and had RAID file systems on them. To resolve:
# list out all mdadm volumes
cat /proc/mdstat
# run for each volume to stop them
sudo mdadm --stop /dev/mdX
# wipe the file system from each partition on the previously
# RAIDed volumes.
sudo wipefs -a /dev/sdXY
# Once all cleared create your pool
sudo zpool create <volanme> raidz sda sdb sdc sdd
ZFS automatically mounts the pool at /volname based on the name you specified when creating the pool.