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

    Accessing pfSense CF card

    Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
    7 Posts 3 Posters 1.8k 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.
    • adamwA
      adamw
      last edited by

      Hello,

      I have just removed a 4GB Compact Flash card from one of ALIX.2 devices running pfSense.

      I've connected it via USB card reader to a server running Debian 8 but struggle to examine any data on it.

      parted /dev/sdb

      GNU Parted 3.2
      Using /dev/sdb
      Welcome to GNU Parted! Type 'help' to view a list of commands.
      (parted) print
      Model:  Multi-Reader -0 (scsi)
      Disk /dev/sdb: 3997MB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos
      Disk Flags:

      Number  Start  End    Size    Type    File system  Flags
      1      32.3kB  1968MB  1968MB  primary              boot
      2      1968MB  3937MB  1968MB  primary
      3      3937MB  3989MB  52.6MB  primary  sun-ufs

      blkid

      /dev/sdb1: PTUUID="90909090" PTTYPE="dos" PARTUUID="90909090-01"
      /dev/sdb2: PTUUID="90909090" PTTYPE="dos" PARTUUID="90909090-02"
      /dev/sdb3: UUID="567870dc15ada898" TYPE="ufs" PARTUUID="90909090-03"

      When trying to mount sdb1 I get:

      dmesg
      [259868.588702] FAT-fs (sdb1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
      [259868.593612] FAT-fs (sdb1): bogus number of reserved sectors
      [259868.593791] FAT-fs (sdb1): Can't find a valid FAT filesystem

      When trying to mount sdb3 as ufs I get:

      mount -t ufs /dev/sdb3 /mnt/tmp1

      mount: /dev/sdb3 is write-protected, mounting read-only

      ls -al /mnt/tmp1

      ls: reading directory /mnt/tmp1: Input/output error
      total 0

      dmesg
      [259227.248028] UFS-fs error (device sdb3): ufs_check_page: bad entry in directory #2: rec_len is too small for name_len - offset=0, rec_len=12, name_len=260
      [259227.248493] UFS-fs error (device sdb3): ufs_readdir: bad page in #2

      How to read it under Linux?

      Is it likely that the card or the image are faulty?

      Thanks
      Adam

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        All three slices should be UFS, so the fact that it says DOS is troubling.

        I have never been able to read UFS volumes on Linux, but there may be some trick I don't know. Your best bet is to boot a BSD system (FreeBSD, PC BSD, etc) and try to mount the card there

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • K
          kpa
          last edited by

          It might say dos but that's for sure a misidenfication, most likely parted not being even aware of the BSD partition type for a primary partition because that's what pfSense uses when you do a standard MBR install. The actual partitions are then inside the BSD type container partition, in FreeBSD terminology if the disk is da0 then the first slice "primary partition" is da0s1 and the first real partition inside the first slice is da0s1a. Linux tools tend to be totally ignorant of this partitioning scheme.

          1 Reply Last reply Reply Quote 0
          • adamwA
            adamw
            last edited by

            I have now booted into FreeBSD 10.3 live DVD and connected the same USB CF card reader with pfSense card.

            "sade" provides me with the following:

            da0 0B
            da1 0B
            da2 0B
            da3 0B
            da4 3.7GB MBR
            da4s1 1.8GB BSD
            da4s1a 1.8GB !0
            da4s2 1.8GB BSD
            da4s2a 1.8GB !0
            da4s3 50MB freebsd
            da5 0B
            da6 0B
            da7 0B

            Does this output makes perfect sense to you and looks healthy?

            Even though the partitioning looks weird (to me) pfSense boots up fine of it!

            1 Reply Last reply Reply Quote 0
            • K
              kpa
              last edited by

              That's the NanoBSD partitioning scheme. There are two main slices, da4s1 and da4s2 and they are duplicate copies of each other to ease the update process. The UFS formatted partitions on those are da4s1a and da4s2a. You should be able to mount them from the live CD/DVD with these commands (using /tmp/* as mount directories because /mnt is read-only on the live CD/DVD environment):

              
              mkdir /tmp/mnt1
              mkdir /tmp/mnt2
              mount /dev/da4s1a /tmp/mnt1
              mount /dev/da4s2a /tmp/mnt2
              
              

              The third slice da4s3 is the configuration slice that holds the configuration files. I don't quite know if it's supposed to be just a slice da4s3 or is there supposed to be partitioning behind it. Try this to mount it directly:

              
              mkdir /tmp/mnt3
              mount /dev/da4s3 /tmp/mnt3
              
              

              If that doesn't work you probably have to use /dev/da4s3a.

              Btw, there is a much better tool for showing partitions on disks:

              
              [2.4.1-RELEASE][admin@firewall.rdnzl.fi]/root: gpart show
              =>      40  62533216  ada0  GPT  (30G)
                      40    409600     1  efi  (200M)
                  409640      1024     2  freebsd-boot  (512K)
                  410664       984        - free -  (492K)
                  411648   4194304     3  freebsd-swap  (2.0G)
                 4605952  57925632     4  freebsd-zfs  (28G)
                62531584      1672        - free -  (836K)
              
              
              1 Reply Last reply Reply Quote 0
              • adamwA
                adamw
                last edited by

                What I'm actually trying to achieve is to:

                1. Save an image / data of this (4G) card in case I need it back on it in the future (I'm suspecting the image is a 2G one).

                Can I easily create a single .img file to be re-imported?
                What other methods would you suggest?

                2. Put a fresh image on it (I already have pfSense-CE-2.3.4-RELEASE-4g-i386-nanobsd.img downloaded).

                Most likely I will use Rufus or Win32 Disk Imager as suggested here:
                https://doc.pfsense.org/index.php/Writing_Disk_Images

                3. Import pfSense config from another ALIX2 device running an ancient 2.0.1 release.

                4. Make a trip to the Data Centre and quickly swap the devices.

                This is another related thread of mine:

                https://forum.pfsense.org/index.php?topic=138174.0

                Do I need a bigger CF card, say 8GB to store 2 copies of 4G image plus configuration?
                Or is the image already appropriately sliced?

                1 Reply Last reply Reply Quote 0
                • K
                  kpa
                  last edited by

                  I'm not too familiar with NanoBSD but I just happened to be aware of how the partitioning works there. You'll have to hope that someone who knows more shares their knowledge here.

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