[Bug 296208] gpart(8): Backup/Create/Restore Differences
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 296208] gpart(8): Backup/Create/Restore Differences"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 23 Jun 2026 02:49:10 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296208
Jose Luis Duran <jlduran@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #272064|0 |1
is obsolete| |
--- Comment #3 from Jose Luis Duran <jlduran@FreeBSD.org> ---
Created attachment 272065
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=272065&action=edit
Fix the final LBA as well.
Compile the kernel with the patch:
/usr/src # make -j $(nproc) buildkernel
...
/usr/src # INSTKERNNAME=kernel.bz_296208 make -j $(nproc) installkernel
...
/usr/src # nextboot -k kernel.bz_296208
zfs bootenv is successfully written
/usr/src # shutdown -r now
...
Let's test:
# truncate -s 1G /tmp/md0.dat
# mdconfig -a -t vnode -f /tmp/md0.dat -u 0
# gpart create -s GPT /dev/md0
md0 created
# gpart add -a 4k -s 512K -t freebsd-boot -l gptboot0 md0
md0p1 added
# gpart add -a 4k -s 40M -t efi -l efiboot0 md0
md0p2 added
# gpart add -a 4k -t freebsd-zfs -l zfs0 md0
md0p3 added
# gpart show md0
=> 34 2097085 md0 GPT (1.0G)
34 6 - free - (3.0K)
40 1024 1 freebsd-boot (512K)
1064 81920 2 efi (40M)
82984 2014128 3 freebsd-zfs (983M)
2097112 7 - free - (3.5K)
Note that our patch prevented gpart add -a 4k from setting the first usable LBA
= 40, and also the last usable LBA.
Now, lets backup/restore:
# truncate -s 1G /tmp/md1.dat
# mdconfig -a -t vnode -f /tmp/md1.dat -u 1
# gpart backup md0 | gpart restore md1
# gpart show md1
=> 34 2097085 md1 GPT (1.0G)
34 6 - free - (3.0K)
40 1024 1 freebsd-boot (512K)
1064 81920 2 efi (40M)
82984 2014128 3 freebsd-zfs (983M)
2097112 7 - free - (3.5K)
I think ultimately, it is a matter of aesthetics. The current behavior
produces a "cleaner" output.
Cleanup:
# mdconfig -d -u 0
# mdconfig -d -u 1
# rm -f /tmp/md0.dat /tmp/md1.dat
--
You are receiving this mail because:
You are the assignee for the bug.