Re: Migrating to new disk

From: Henrik Morsing <henrik_at_morsing.cc>
Date: Sun, 02 Apr 2023 21:18:32 UTC
On Sun, Apr 02, 2023 at 03:09:15PM -0400, mike tancsa wrote:

Hi Mike,

[...]
>>
>>
>What does
>
>gpart list
>
>show on your new disk ?

At bottom of this email.

>
>When I do a bare metal restore, I do something like this
>
>echo ""
>echo "# Create zfs boot (512k) and a 220 gig root partition"
>gpart create -s gpt $DESTDEVICE
>gpart add -a 4k -s 40M -t efi $DESTDEVICE
>gpart add -a 4k  -s 8G -t freebsd-swap -l swap1 $DESTDEVICE
>gpart add -a 4k  -t freebsd-zfs -l $DISKNAME $DESTDEVICE
>newfs_msdos -F 32 -c 1 /dev/${DESTDEVICE}p1
>mkdir -p /mnttmp
>mount -t msdosfs /dev/${DESTDEVICE}p1 /mnttmp
>mkdir -p /mnttmp/EFI/BOOT
>cp /boot/loader.efi /mnttmp/EFI/BOOT/BOOTX64.efi
>umount /mnttmp

Exact same steps I have done. When I boot I get this:

http://www.aixperts.co.uk/EFI_boot.png

gpart list nvd0:


root@freebsd:~ # gpart list nvd0
Geom name: nvd0
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 976773127
first: 40
entries: 128
scheme: GPT
Providers:
1. Name: nvd0p1
    Mediasize: 629145600 (600M)
    Sectorsize: 512
    Stripesize: 0
    Stripeoffset: 20480
    Mode: r0w0e0
    efimedia: HD(1,GPT,7720b051-d188-11ed-96b0-581122b5b379,0x28,0x12c000)
    rawuuid: 7720b051-d188-11ed-96b0-581122b5b379
    rawtype: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
    label: efiboot
    length: 629145600
    offset: 20480
    type: efi
    index: 1
    end: 1228839
    start: 40
2. Name: nvd0p2
    Mediasize: 482298806272 (449G)
    Sectorsize: 512
    Stripesize: 0
    Stripeoffset: 17809035264
    Mode: r0w0e0
    efimedia: HD(2,GPT,e2f387f6-d188-11ed-96b0-581122b5b379,0x212c028,0x38259fe0)
    rawuuid: e2f387f6-d188-11ed-96b0-581122b5b379
    rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
    label: zfs
    length: 482298806272
    offset: 17809035264
    type: freebsd-zfs
    index: 2
    end: 976773127
    start: 34783272
3. Name: nvd0p3
    Mediasize: 17179869184 (16G)
    Sectorsize: 512
    Stripesize: 0
    Stripeoffset: 629166080
    Mode: r0w0e0
    efimedia: HD(3,GPT,e19f9a81-d188-11ed-96b0-581122b5b379,0x12c028,0x2000000)
    rawuuid: e19f9a81-d188-11ed-96b0-581122b5b379
    rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
    label: swap
    length: 17179869184
    offset: 629166080
    type: freebsd-swap
    index: 3
    end: 34783271
    start: 1228840
Consumers:
1. Name: nvd0
    Mediasize: 500107862016 (466G)
    Sectorsize: 512
    Mode: r0w0e0



efibootmgr -v:


root@freebsd:~ # efibootmgr -v
Boot to FW : false
BootCurrent: 000f
Timeout    : 1 seconds
BootOrder  : 000E, 000F
  Boot000E* UEFI OS HD(1,GPT,7720b051-d188-11ed-96b0-581122b5b379,0x28,0x12c000)/File(\EFI\BOOT\BOOTX64.EFI)
                       nvd0p1:/EFI/BOOT/BOOTX64.EFI (null)
+Boot000F* UEFI OS HD(1,GPT,69a5eb60-c03c-11ed-9beb-df2246128862,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                       ada0p1:/EFI/BOOT/BOOTX64.EFI (null)


Unreferenced Variables:
  Boot0002  rEFInd HD(1,GPT,7720b051-d188-11ed-96b0-581122b5b379,0x28,0x12c000)/File(\EFI\REFIND\BOOTX64.EFI)
                      nvd0p1:/EFI/REFIND/BOOTX64.EFI (null)
  Boot0003* UEFI OS HD(1,GPT,69a5eb60-c03c-11ed-9beb-df2246128862,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                       ada0p1:/EFI/BOOT/BOOTX64.EFI (null)
  Boot0000* FreeBSD HD(1,GPT,06549b64-d166-11ed-af53-bbccc405f5c1,0x28,0x82000)/File(\EFI\FREEBSD\LOADER.EFI)
  Boot0001* UEFI: Generic STORAGE DEVICE 0272, Partition 1 PciRoot(0x0)/Pci(0x14,0x0)/USB(0x8,0x0)/USB(0x2,0x0)/HD(1,MBR,0x00000000,0x2000,0x1e1d800)
                                                          VenHw(2d6447ef-3bc9-41a0-ac19-4d51d01b4ce6,3000300030003000300030003000300030003200370032000000)
  Boot000D* UEFI OS HD(1,GPT,69a5eb60-c03c-11ed-9beb-df2246128862,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                       ada0p1:/EFI/BOOT/BOOTX64.EFI (null)


Regards,
Henrik Morsing
--