ZFS How to persist zfs mount points in between system reboot for a memory disk root

Hello All,

I am using mfsbsd (https://github.com/mmatuska/mfsbsd) to create an ISO with some of my own custom changes in it. I wanted to keep memory disk mounted to / (root) and for storage I wanted to use zfs, on hardisk.

I tried following to achieve it with no success yet .i.e.

1.) created 3 partitions as below
.i.e boot, root(UFS) and storage (ZFS) ( device use here is of 16 GB)

Code:
root@mfsbsd:~ # /sbin/gpart add -t freebsd-boot -b 40 -s 472 /dev/ada0
ada0p1 added

root@mfsbsd:~ # /sbin/gpart add -t freebsd-ufs -s 4g -l gprootfs /dev/ada0
ada0p2 added

root@mfsbsd:~ # /sbin/gpart add -t freebsd-zfs -l gpstoragefs /dev/ada0
ada0p3 added

root@mfsbsd:~ # gpart show /dev/ada0
=>      40  33554352  ada0  GPT  (16G)
        40       472     1  freebsd-boot  (236K)
       512   8388608     2  freebsd-ufs  (4.0G)
   8389120  25165272     3  freebsd-zfs  (12G)     

gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 /dev/ada0 ( install gpt boot code )


2.) Keeping ISO mounted copied content from ISO to disk

Code:
 newfs -U /dev/gpt/gprootfs
mount /dev/gpt/gprootfs /media/disk
mount -t cd9660 /dev/cd0 /media/cdrom
cp -r /media/cdrom/ /media/disk/.

3.) created zpool over partion 3 .i.e.

root@mfsbsd:/media/disk # sbin/zpool create -f -m none -o 'cachefile=/boot/zfs/zpool.cache' Storage ada0p3

4.) Created zfs on storage Pool .i.e.

Code:
root@mfsbsd:/media/disk # /sbin/zfs create -o 'mountpoint=/storage' Storage/storage
     
root@mfsbsd:/media/disk # mount
     /dev/md0 on / (ufs, local, read-only)
     devfs on /dev (devfs, local, multilabel)
     tmpfs on /rw (tmpfs, local)
     devfs on /rw/dev (devfs, local, multilabel)
     /dev/gpt/gprootfs on /rw/media/disk (ufs, local, soft-updates)
     /dev/cd0 on /rw/media/cdrom (cd9660, local, read-only)
     Storage/storage on /rw/storage (zfs, local, nfsv4acls)

5.) copied zpool cache to disk boot folder

.i.e. cp /boot/zfs/zpool.cache /media/disk/boot/zfs/.

However when did the reboot( from hard-disk), zpool/zfs related changes does not persist.

in attempt 2 I have install zfsboot code
/sbin/gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0

however it fails with giving error not able to find boot/zfsloader and /boot/loader


please guide me how to achieve persist mount points of zfs pools, in between reboots of an mfsbsd image
 
Back
Top