Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Apr 2023 15:09:15 -0400
From:      mike tancsa <mike@sentex.net>
To:        Henrik Morsing <henrik@morsing.cc>
Cc:        questions@freebsd.org
Subject:   Re: Migrating to new disk
Message-ID:  <8657aa62-1405-1d60-1dd7-f64f99da3ab2@sentex.net>
In-Reply-To: <ZCmgxWVc1g9oKCnc@morsing.cc>
References:  <ZCgN887wVFE%2BOMR3@morsing.cc> <ZCmgxWVc1g9oKCnc@morsing.cc>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8657aa62-1405-1d60-1dd7-f64f99da3ab2>