[Bug 274312] gpart restore fails with "gpart: entries '4': Invalid argument"

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 06 Oct 2023 17:58:44 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274312

            Bug ID: 274312
           Summary: gpart restore fails with "gpart: entries '4': Invalid
                    argument"
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: editor@callfortesting.org

Created attachment 245469
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=245469&action=edit
truss(1) output for the gpart backup/restore command

Hello, I see a few PRs related to gpart restore but not with this error. I have
only seen mentions of the error in mailing lists.

FreeBSD freebsd 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n265728-8818f0f1124e:
Thu Oct  5 03:15:28 UTC 2023    
root@releng3.nyi.freebsd.org:/usr/obj/usr/src/a
md64.amd64/sys/GENERIC amd64

Steps:

root@freebsd:~ # sysctl kern.disks
kern.disks: vtbd1 vtbd0
root@freebsd:~ # gpart show
=>       3  12649842  vtbd0  GPT  (6.0G)
         3       346      1  freebsd-boot  (173K)
       349     66584      2  efi  (33M)
     66933   2097152      3  freebsd-swap  (1.0G)
   2164085  10485760      4  freebsd-zfs  (5.0G)

root@freebsd:~ # diskinfo vtbd0
vtbd0   512     6476721664      12649847        131072  0
root@freebsd:~ # diskinfo vtbd1
vtbd1   512     6476721664      12649847        131072  0

root@freebsd:~ # man gpart | grep restore | tail -1
           /sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2

root@freebsd:~ # /sbin/gpart backup vtbd0 | /sbin/gpart restore -F vtbd1
gpart: entries '4': Invalid argument

The vtbd0 is a root-on-ZFS weekly snapshot image and the second image is
created with truncate, using the size from the unmodified RE image.

Backing up the partition table to a file and restoring from file produces the
same error.

I have attached the truss output of the command listed in the manual page.

-- 
You are receiving this mail because:
You are the assignee for the bug.