Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    SG1100 with external USB ZFS disk?

    Scheduled Pinned Locked Moved General pfSense Questions
    11 Posts 5 Posters 522 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hoopy
      last edited by hoopy

      I just tried to setup a ZFS pool on an external USB disk on my SG1100.
      The SG1100 itself has been using ZFS for quite a while now - no problems there.
      The external ZFS pool/dataset also works just fine, but after a reboot the external disk is not automatically imported (mounted).

      When I try to import it manually, I get the error:
      cannot import 'dump' pool was previously in use from another system
      Last accessed by {hostname} (hostid=1c8e15e7) at Sun Feb 16 23:59:30 2025

      (Strangely, the hostid changes with each reboot?!)

      Does anyone know how to prevent this error,
      thus allowing the pool to be imported automatically at boot?

      The only way I can get the external USB disk going again is to login to the root shell and manually run zpool import -f ... :-(

      Thanks in advance,

      Hoopy

      Details:

      My goal is to have a large disk where I can record long-term tcpdumps (for debugging a VLAN-quarantined PC) without risking filling the SG1100's tiny onboard storage (already at 96%).

      Here's what I did so far:

      Identify the USB Disk:

      # geom disk list
      ...
      Geom name: da0
      1. Name: da0
         Mediasize: 2000365289472 (1.8T)
         descr: WD Elements 10B8
      ...
      

      create a ZFS pool:

      # zpool create dump /dev/da
      # zpool list
      NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
      dump     1.81T   432K  1.81T        -         -     0%     0%  1.00x    ONLINE  -
      pfSense  6.75G  5.79G   982M        -         -    59%    85%  1.00x    ONLINE  -# zfs list 
      # zfs get all dump | grep mount | sort
      dump  canmount              on                     default
      dump  mounted               yes                    -
      dump  mountpoint            /dump                  default
      

      after reboot...

      # zpool list
      NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
      pfSense  6.75G  5.79G   981M        -         -    58%    85%  1.00x    ONLINE  -
      # zpool import -a
      cannot import 'dump': pool was previously in use from another system.
      Last accessed by {hostname} (hostid=1c8e15e7) at Sun Feb 16 23:59:30 2025
      The pool can be imported, use 'zpool import -f' to import the pool.
      # zpool import -a -f
      # zpool list
      NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
      dump     1.81T   528K  1.81T        -         -     0%     0%  1.00x    ONLINE  -
      pfSense  6.75G  5.79G   982M        -         -    58%    85%  1.00x    ONLINE  -
      
      S 1 Reply Last reply Reply Quote 0
      • S
        SteveITS Galactic Empire @hoopy
        last edited by

        @hoopy This is probably not the best answer but you could run your command via the pfSense cron package.

        Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
        When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
        Upvote ๐Ÿ‘ helpful posts!

        1 Reply Last reply Reply Quote 0
        • stephenw10S
          stephenw10 Netgate Administrator
          last edited by

          Or a shellcmd at boot.

          1 Reply Last reply Reply Quote 0
          • H
            hoopy
            last edited by

            Please forgive me if I sound negative or ungrateful, but to my mind these answers are analogous to me asking "My check-engine light on! How can I fix my car?" and getting the response "simple, just disconnect the check-engine light".
            Another solution, probably more appropriate for me, would be: "just don't reboot (very often)".

            pfSense's root file system is ZFS and pfsense manages to remount it after reboots without any problems. Surely there has to be a "proper" way to re-mount non-root ZFS pools, without using the -f, "ignore any errors and just do it", flag?!

            By the way, in case someone suggests I should ask an AI... I just did and, as expected, it spewed out a page and a half of useless standard text, however, it did mention that "on pfSense, you can set a static hostid by adding the following line to /etc/rc.conf:

            sysctl kern.hostid=<desired static hostid>
            

            For me, this sounds like the same approach from a different angle, and there was no mention of possible side effects or other consequences. (See also: random number - xkcd)

            I have found no documentation from Netgate regarding the use of external storage. Perhaps this could be a "feature" waiting for one of the next versions?

            stephenw10S 1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator @hoopy
              last edited by

              @hoopy said in SG1100 with external USB ZFS disk?:

              I have found no documentation from Netgate regarding the use of external storage.

              Because it's not supported. ๐Ÿ˜‰
              pfSense doesn't use the FreeBSD rc system and has no functionality to add additional drives for use by the system. Other users have done it. There are various threads discussing it. Generally some custom scripting etc.

              H 1 Reply Last reply Reply Quote 0
              • H
                hoopy @stephenw10
                last edited by

                @stephenw10 thank for clarifying that.

                So I'll just write zpool import -f -a on a sticky note and stick on the box - I usually only reboot after installing an update :-)

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  Ha, well I guess that would work. But adding it as a shellcmd would also.

                  https://docs.netgate.com/pfsense/en/latest/development/boot-commands.html#shellcmd-option

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    hoopy @stephenw10
                    last edited by hoopy

                    @stephenw10 thanks for the tip!
                    I'd call this thread closed / solved now.

                    GertjanG 1 Reply Last reply Reply Quote 1
                    • GertjanG
                      Gertjan @hoopy
                      last edited by

                      @hoopy

                      What about these thoughts :
                      ZFS is a, what I call it, a high end file system.
                      It creates a lot of reads & writes to the filesystem, which is attached be a rather slow connection : the USB.
                      Why not using a less sophisticated file system like ext4 or ufs, or even ms-dos for your USB drive ?
                      You have more "speed" and be able to remove the USB drive and access it with some other device !

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      H 1 Reply Last reply Reply Quote 0
                      • H
                        hoopy @Gertjan
                        last edited by

                        @Gertjan considering that I'm only intending to collect tcpdump logs, you're probably right about using a less sophisticated file system. If I run into problems, I just might do as you suggest.

                        As for ZFS, I've been a fan and user of ZFS since around 2010, including running RAIDZ with 4 external USB disks - works just fine!
                        Performance has generally not been a problem, however,
                        over the years I've had plenty of hardware disk failures but never actually lost any data (due to either RAIDZ or "copies=2" when only 1 disk is available, besides backups). That, combined with a CLI which is far easier to comprehend and remember are the two main reasons why everything else just feels... half-baked :-)

                        Hopefully this discussion might help someone else in a similar situation.

                        Cheers

                        1 Reply Last reply Reply Quote 0
                        • JonathanLeeJ
                          JonathanLee
                          last edited by

                          Cron job @reboot the mount commands

                          Make sure to upvote

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.