Solved automount zfs partition from usb drive at boot

M

mononote

Guest
Hello.

I recently installed freebsd 13 release on a raspberry pi 4 (copying the image on a sd card using dd). I want to use a usb drive to hold some data, such as music, and I would like it to be mounted on boot because some service requires it. Ever command was executed as root. I first created the file system on another freebsd 13 machine and copied some data, then moved the device to the other machine (I'm new to zfs and made some mistakes). Now it mounts on /data when executing zpool import da0p1, but upon rebooting it won't automatically mount it.

On the raspberry pi I've added zfs_enable="YES" to /etc/rc.conf and zfs_load="YES" to /boot/loader.conf (is the second one necessary?), following some results on the forum from similar threads.

Here is the output of gpart show
Code:
=>       63  125173697  mmcsd0  MBR  (60G)
         63       2016          - free -  (1.0M)
       2079     102312       1  fat32lba  [active]  (50M)
     104391  125069369       2  freebsd  (60G)

=>        0  125069369  mmcsd0s2  BSD  (60G)
          0         57            - free -  (29K)
         57  125069312         1  freebsd-ufs  (60G)

=>       40  125313208  da0  GPT  (60G)
         40  125313208    1  freebsd-zfs  (60G)

and of zpool history da0p1 | cut -d " " -f "2-"
Code:
for 'da0p1':
zpool create data /dev/da0p1
zpool import -f data da0p1
zpool export da0p1
zpool import da0p1 data
zpool import data da0p1
zpool export da0p1
zpool import da0p1 data
zpool import data
zpool import data
zpool import data da0p1
zpool export da0p1
zpool import da0p1
zfs set mountpoint=/data da0p1
zpool import da0p1
zpool export da0p1
zpool import da0p1
zpool export da0p1
zpool import -R /data da0p1
zpool export da0p1
zpool import -R / da0p1
zpool import da0p1

and of zfs get all da0p1
Code:
NAME   PROPERTY              VALUE                  SOURCE
da0p1  type                  filesystem             -
da0p1  creation              Mon Apr 26 13:22 2021  -
da0p1  used                  10.8G                  -
da0p1  available             46.8G                  -
da0p1  referenced            10.8G                  -
da0p1  compressratio         1.00x                  -
da0p1  mounted               yes                    -
da0p1  quota                 none                   default
da0p1  reservation           none                   default
da0p1  recordsize            128K                   default
da0p1  mountpoint            /data                  local
da0p1  sharenfs              off                    default
da0p1  checksum              on                     default
da0p1  compression           off                    default
da0p1  atime                 on                     default
da0p1  devices               on                     default
da0p1  exec                  on                     default
da0p1  setuid                on                     default
da0p1  readonly              off                    default
da0p1  jailed                off                    default
da0p1  snapdir               hidden                 default
da0p1  aclmode               discard                default
da0p1  aclinherit            restricted             default
da0p1  createtxg             1                      -
da0p1  canmount              on                     default
da0p1  xattr                 on                     default
da0p1  copies                1                      default
da0p1  version               5                      -
da0p1  utf8only              off                    -
da0p1  normalization         none                   -
da0p1  casesensitivity       sensitive              -
da0p1  vscan                 off                    default
da0p1  nbmand                off                    default
da0p1  sharesmb              off                    default
da0p1  refquota              none                   default
da0p1  refreservation        none                   default
da0p1  guid                  7304697230205506584    -
da0p1  primarycache          all                    default
da0p1  secondarycache        all                    default
da0p1  usedbysnapshots       0B                     -
da0p1  usedbydataset         10.8G                  -
da0p1  usedbychildren        3.18M                  -
da0p1  usedbyrefreservation  0B                     -
da0p1  logbias               latency                default
da0p1  objsetid              54                     -
da0p1  dedup                 off                    default
da0p1  mlslabel              none                   default
da0p1  sync                  standard               default
da0p1  dnodesize             legacy                 default
da0p1  refcompressratio      1.00x                  -
da0p1  written               10.8G                  -
da0p1  logicalused           10.8G                  -
da0p1  logicalreferenced     10.8G                  -
da0p1  volmode               default                default
da0p1  filesystem_limit      none                   default
da0p1  snapshot_limit        none                   default
da0p1  filesystem_count      none                   default
da0p1  snapshot_count        none                   default
da0p1  snapdev               hidden                 default
da0p1  acltype               nfsv4                  default
da0p1  context               none                   default
da0p1  fscontext             none                   default
da0p1  defcontext            none                   default
da0p1  rootcontext           none                   default
da0p1  relatime              off                    default
da0p1  redundant_metadata    all                    default
da0p1  overlay               on                     default
da0p1  encryption            off                    default
da0p1  keylocation           none                   default
da0p1  keyformat             none                   default
da0p1  pbkdf2iters           0                      default
da0p1  special_small_blocks  0                      default

How do I get it to mount automatically at boot?

Sorry and thanks.
 
Back
Top