Load and unload files into kernel

You can use kldload command to load files into kernel. For example, enter /boot/kernel directory, and use kldstat to check currently loaded files:

  1. # cd /boot/kernel
  2. # kldstat
  3. Id Refs Address Size Name
  4. 1 6 0xffffffff80200000 17bc6a8 kernel
  5. 2 1 0xffffffff81a11000 56c6 fdescfs.ko
  6. 3 1 0xffffffff81a17000 2ba8 uhid.ko

Use kldload to load zfs.ko file:

  1. # kldload zfs.ko
  2. # kldstat
  3. Id Refs Address Size Name
  4. 1 15 0xffffffff80200000 17bc6a8 kernel
  5. 2 1 0xffffffff81a11000 56c6 fdescfs.ko
  6. 3 1 0xffffffff81a17000 2ba8 uhid.ko
  7. 7 1 0xffffffff81a1a000 1ee0c8 zfs.ko
  8. 8 1 0xffffffff81c09000 3330 opensolaris.ko

You can see the zfs.ko is loaded successfully.

Unloading file uses kldunload command:

  1. # kldunload zfs.ko
  2. # kldstat
  3. Id Refs Address Size Name
  4. 1 6 0xffffffff80200000 17bc6a8 kernel
  5. 2 1 0xffffffff81a11000 56c6 fdescfs.ko
  6. 3 1 0xffffffff81a17000 2ba8 uhid.ko

Reference:
kldload;
kldunload.