Brandon Darbro
Cadet
- Joined
- Oct 24, 2013
- Messages
- 1
Using FreeNAS via thumb drive image leaves us with a / filesystem that isn't writable, of course. The googling around we've done shows you can remount read / write, make the few changes you need, and remount read-only again. Those same places mentioned the same thing we end up seeing... A terrible slowness to commit those changes and remount when going back to read-only, during which, other I/O seems to stop.
Well, for automation, I'm needing to install a lot of ssh keys. But, as luck would have it, FreeBSD supports UnionFS. Sweet!
I can create a "root" directory under /var, or /mnt... or in my case, create a dataset at /mnt/pool01/root.
The advantage of placing this on my ZFS data volume is that if I need to swap to a backup USB stick to boot FreeNAS, the data will be persistent.
Now for the fun part:
Go to 'Init/Shutdown Scripts' in the web ui.
Click 'Add Init/Shutdown Script'
Then Type is: command
Command is: mount -t unionfs -o noatime /mnt/pool01/root /root (or use whatever path you used, maybe /var/root?)
Set Type: Post Init
Reboot, or from a root shell, issue the same command as the Command above, and you are set with a writable /root directory.
And that's it. You now have a writable /root with usable performance, while keeping the rest of / read-only.
Any new files or changes you make to /root will go to the destination directory, like /mnt/pool01/root for permanent storage, but will very nicely appear in /root, as well.
I'm not seeing any ill effects from this. If anyone can think of any, please let me know.
Well, for automation, I'm needing to install a lot of ssh keys. But, as luck would have it, FreeBSD supports UnionFS. Sweet!
I can create a "root" directory under /var, or /mnt... or in my case, create a dataset at /mnt/pool01/root.
The advantage of placing this on my ZFS data volume is that if I need to swap to a backup USB stick to boot FreeNAS, the data will be persistent.
Now for the fun part:
Go to 'Init/Shutdown Scripts' in the web ui.
Click 'Add Init/Shutdown Script'
Then Type is: command
Command is: mount -t unionfs -o noatime /mnt/pool01/root /root (or use whatever path you used, maybe /var/root?)
Set Type: Post Init
Reboot, or from a root shell, issue the same command as the Command above, and you are set with a writable /root directory.
And that's it. You now have a writable /root with usable performance, while keeping the rest of / read-only.
Any new files or changes you make to /root will go to the destination directory, like /mnt/pool01/root for permanent storage, but will very nicely appear in /root, as well.
I'm not seeing any ill effects from this. If anyone can think of any, please let me know.