gpart: geom 'nda1': Operation not permitted when adding 2nd disk to Opensense

Started by bx2, March 22, 2025, 01:14:57 AM

Previous topic - Next topic
Hello everyone,

I have the CWWK N100 and I'm looking to add another NVME drive into it just for redundancy as I have the spare drives.

I have been looking at these instructions (https://forum.opnsense.org/index.php?topic=32650.0) which seem simple enough but I'm getting hung up on the steps to copy the partition table.

"gpart backup ada0 | gpart restore -F ada1"
When I run geom list disk, I see both of my drives showing:

root@OPNsense:~ # geom disk list
Geom name: nda0
Providers:
1. Name: nda0
   Mediasize: 500107862016 (466G)
   Sectorsize: 512
   Mode: r3w3e6
   descr: KINGSTON SNV2S500G
   lunid: 00000000000000000026b76865cfcd85
   ident: 50026B76865CFCD8
   rotationrate: 0
   fwsectors: 0
   fwheads: 0

Geom name: nda1
Providers:
1. Name: nda1
   Mediasize: 500107862016 (466G)
   Sectorsize: 512
   Mode: r1w1e1
   descr: KINGSTON SNV2S500G
   lunid: 00000000000000000026b7686c0a0ee5
   ident: 50026B7686C0A0EE
   rotationrate: 0
   fwsectors: 0
   fwheads: 0



root@OPNsense:~ # gpart show
=>       40  976773088  nda0  GPT  (466G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528   16777216     3  freebsd-swap  (8.0G)
   17311744  959461376     4  freebsd-zfs  (458G)
  976773120          8        - free -  (4.0K)

My opnsense is installed on nda0 but when I run the command to start copying the partition table, I get an error stating:

root@OPNsense:~ # gpart backup nda0 | gpart restore -F nda1
gpart: geom 'nda1': Operation not permitted

Now, nda1 (the new drive) may have been formatted and used in another random PC so I'm unsure if its an issue with formatting?

I don't think that it is related to formatting but I'm not entirely sure.

Has anybody else ran into this issue?

Quote from: bx2 on March 22, 2025, 01:14:57 AMNow, nda1 (the new drive) may have been formatted and used in another random PC so I'm unsure if its an issue with formatting?
Can you try wiping the new drive first (sure you do it on the right device! Backup is always a good idea, of course):

As mentioned in OPNsense Forum: Formatting whole disk before installation, try destroy the disk and delete the first 1M of the drive:

gpart destroy -F nda1
dd if=/dev/zero of=/dev/nda1 bs=1M count=1
Deciso DEC740

Quote from: patient0 on March 22, 2025, 07:50:07 AM
Quote from: bx2 on March 22, 2025, 01:14:57 AMNow, nda1 (the new drive) may have been formatted and used in another random PC so I'm unsure if its an issue with formatting?
Can you try wiping the new drive first (sure you do it on the right device! Backup is always a good idea, of course):

As mentioned in OPNsense Forum: Formatting whole disk before installation, try destroy the disk and delete the first 1M of the drive:

gpart destroy -F nda1
dd if=/dev/zero of=/dev/nda1 bs=1M count=1


Thank you,

That doesn't seem to work.

root@OPNsense:~ # gpart destroy -F nda1
gpart: arg0 'nda1': Invalid argument


I did a bit more searching around and I came across a similar issue on a different system-forum:
https://www.truenas.com/community/threads/create-new-pool-ends-with-error-command-gpart-create-s-gpt-dev-ada0-returned-non-zero-exit-status-1.77775/

I did set
sysctl kern.geom.debugflags=16

and then I ran
gpart create -s gpt /dev/nda1
After that, I then was able to proceed with the instructions for adding the second NVME disk to Opnsense.

Now it looks like everything is complete.

When I go into zpool status, I can see both nda0p4 and nda1p4 listed.

root@OPNsense:~ # zpool status
  pool: zroot
 state: ONLINE
status: Some supported and requested features are not enabled on the pool.
        The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(7) for details.
  scan: resilvered 2.33G in 00:00:04 with 0 errors on Sat Mar 22 10:59:11 2025
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            nda0p4  ONLINE       0     0     0
            nda1p4  ONLINE       0     0     0

errors: No known data errors


Thank you,