FreeNAS root on ZFS

Discussion in 'nanobsd' started by HarryE, Aug 5, 2011.

  1. Offline

    HarryE

    Member Since:
    May 27, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    1
    HarryE, Aug 5, 2011

    As I am a big fan of ZFS, I tweaked FreeNAS to boot&run completely from ZFS. No UFS at all. On a single 2Gb stick, root filesystem takes 431Mb on ZFS.
    Having root on ZFS brings the advantages of customization of the filesystem (rw root) without the worries of "pulling-the-plug" solved by read-only root +MD of nanobsd.
    The upgrades/downgrades could be simple zfs receive or clone/rollbacks.


    The web interface doesn't see the zpool but sees the snapshots in root zfs.
    I suppose I have to go into some sqlite db and manually add something, since the autoimport doesn't work for active zpools.

    Any ideas on how to do this?
  2. Offline

    survive Super Moderator

    Member Since:
    May 28, 2011
    Messages:
    829
    Message Count:
    829
    Likes Received:
    20
    Trophy Points:
    18
    Occupation:
    Senior Systems Engineer
    Location:
    Missouri, USA
    survive, Aug 5, 2011

    Hi HarryE,

    Sounds like a very cool project you have going on there. Be sure to let us know what you find out!

    -Will
  3. Offline

    HarryE

    Member Since:
    May 27, 2011
    Messages:
    5
    Message Count:
    5
    Likes Received:
    0
    Trophy Points:
    1
    HarryE, Aug 5, 2011

    Almost there...

    Here it is:
    I used my regular FreeBSD 8.2 to create 3 partitions on a 2GB stick as described in FreeBSD's Root-on-zfs tutorial, 1 for bootstrap, one for swap, and one for zpool.
    Then I created the zpool, named it nanozfs to please the two worlds :) . Inside I created 3 zfs filesystems named nanozfs/part1, nanozfs/cfg and nanozfs/data.
    Next I copied the content of the FreeNAS partitions from another stick into nanozfs/part1, nanozfs/cfg and nanozfs/data filesystems accordingly.
    Adjusted loader.conf, fstab, rc.conf and created a necessary fsck_zfs (as a simple exit 0). Removed /conf/default/etc/remount.
    At some point there was a "zpool set bootfs=nanozfs/part1 nanozfs" involved.
    Since then I found the necessary tables to be modified in order to manually import zfs filesystems into web interface.
    In the morning I'll download a newer version of FreeNas, create a nanozfs/part2 filesystem, copy the content + tweaks into it.
    Then snaphot nanozfs/cfg, nanozfs/data just in case I want to rollback.
    A zpool set bootfs=nanozfs/part2 nanozfs will help to boot the new version.

Share This Page