From nobody Sun Apr 02 19:09:15 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PqNql4X2kz444BX for ; Sun, 2 Apr 2023 19:09:23 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost1.sentex.ca (smarthost1.sentex.ca [IPv6:2607:f3e0:0:1::12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smarthost1.sentex.ca", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PqNql2fm0z4Hwv for ; Sun, 2 Apr 2023 19:09:23 +0000 (UTC) (envelope-from mike@sentex.net) Authentication-Results: mx1.freebsd.org; none Received: from pyroxene2a.sentex.ca (pyroxene19.sentex.ca [199.212.134.19]) by smarthost1.sentex.ca (8.17.1/8.16.1) with ESMTPS id 332J9GuD093010 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=FAIL); Sun, 2 Apr 2023 15:09:16 -0400 (EDT) (envelope-from mike@sentex.net) Received: from [IPV6:2607:f3e0:0:4::29] ([IPv6:2607:f3e0:0:4:0:0:0:29]) by pyroxene2a.sentex.ca (8.16.1/8.15.2) with ESMTPS id 332J9FDS025571 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sun, 2 Apr 2023 15:09:15 -0400 (EDT) (envelope-from mike@sentex.net) Message-ID: <8657aa62-1405-1d60-1dd7-f64f99da3ab2@sentex.net> Date: Sun, 2 Apr 2023 15:09:15 -0400 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: Migrating to new disk Content-Language: en-US To: Henrik Morsing Cc: questions@freebsd.org References: From: mike tancsa In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 X-Rspamd-Queue-Id: 4PqNql2fm0z4Hwv X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:11647, ipnet:2607:f3e0::/32, country:CA] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 4/2/2023 11:35 AM, Henrik Morsing wrote: > On Sat, Apr 01, 2023 at 11:56:51AM +0100, Henrik Morsing wrote: >> >> Good morning. >> >> I have a fairly new install of 13.1, root on ZFS. New computer with >> an ASUS Z690-P motherboard. >> >> I have migrated to a new disk using zfs send/recv, and ran an EFI >> update command from the same guide >> (https://people.freebsd.org/~dch/posts/2021-05-12-nvme-on-freebsd.html). >> The disk is now bootable from the UEFI bootlist, but I still end up >> on the old zroot. I am guessing I need to rename the new zpool? Or is >> there another way? And is it simple to boot into a live USB and >> rename, or is it a can of worms? >> >> > > I'm fairly certain this is a pure EFI issue. Pulling out the old disk, > the disk shows up in the UFEI boot menu, but when booting from it, I > get a message saying there is no disk to boot from. > > Somewhere under /boot/efi, there must be info on which disk/kernel to > boot, but it is probably in a binary format. > > What does gpart list show on your new disk ? 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 echo ""  # Option 1: align to 4K, ashift=12  echo "# Align the Disks for 4K (ashift=12) and create the pool"  gnop create -S 4096 /dev/gpt/$DISKNAME  # Option 2: align to 8k, ashift=13 #echo "# Align the Disks for 8K (ashift=13) and create the pool" #gnop create -S 8192 /dev/gpt/disk0 zpool create -d -f -o altroot=/mnt -o feature@lz4_compress=enabled -o cachefile=/var/tmp/zpool.cache $POOLNAME /dev/gpt/$DISKNAME.nop zpool export $POOLNAME gnop destroy /dev/gpt/$DISKNAME.nop zpool import -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache $POOLNAME echo "" echo "# Set the bootfs property and set options" zpool set listsnapshots=on $POOLNAME zfs set logbias=throughput $POOLNAME zfs set compression=lz4 $POOLNAME zfs set atime=off $POOLNAME #ignore the first one i=0 for snap in ${snapshots[@]} do         if [[ $i -eq 0 ]];then                 i=$i+1                 continue         fi         zfs send -v ${snapshots[$i]} | zfs recv -F ${destination[$i]}         i=$i+1 done set +e zfs set canmount=off $POOLNAME/var zfs set canmount=off $POOLNAME/usr zfs set canmount=off $POOLNAME zfs set mountpoint=none $POOLNAME zfs set mountpoint=none $POOLNAME/ROOT zfs set mountpoint=/ $POOLNAME/ROOT/default zfs set mountpoint=/tmp $POOLNAME/tmp zfs set mountpoint=/usr $POOLNAME/usr zfs set mountpoint=/usr/home $POOLNAME/usr/home zfs set mountpoint=/usr/ports $POOLNAME/usr/ports zfs set mountpoint=/usr/src $POOLNAME/usr/src zfs set mountpoint=/var $POOLNAME/var zfs set mountpoint=/var/crash $POOLNAME/var/crash zfs set mountpoint=/var/log $POOLNAME/var/log zfs set mountpoint=/var/mail $POOLNAME/var/mail zfs set mountpoint=/var/tmp $POOLNAME/var/tmp zpool set bootfs=$POOLNAME/ROOT/default $POOLNAME