Re: `zpool list` return No such file or directory

From: Jinsong Zhao <jszhao_at_yeah.net>
Date: Mon, 18 Nov 2024 07:17:52 UTC
On 2024/11/18 0:47, Alan Somers wrote:
> On Sun, Nov 17, 2024 at 6:33 AM Jinsong Zhao <jszhao@yeah.net> wrote:
>>
>> Hi there,
>>
>> I have successfully installed FreeBSD 14.1 root on ZFS using GPT with
>>    VirtualBox. Now I tried to migrate the whole system to a new disk:
>>
>>
>> zfs snapshot E580/ROOT/fb14@today
>>
>> zpool create test /dev/ada1p2
>>
>> zfs send -R E580/ROOT/fb14@today | zfs receive test/fb14
>>
>> All done successfully.
>>
>> After that, I tried to list all pools using
>>
>> zpool list
>>
>> It came back:
>>
>> No such file or directory
> 
> This should be impossible, unless there are some steps missing.  Is
> this on the system with E580 or ada1p2?  Did you reboot after the "zfs
> receive" but before the "zpool list"?  If so, you need to do a "zpool
> import".  If you want that to happen automatically, you need to add
> "zfs_enable=YES" to /etc/rc.conf .

System with E580 is on ada0p2, and the new pool test is on ada1 (or 
ada1p2, the same phenomena). No reboot after "zfs receive".

After several rounds of testing, I think the problem may be that I 
didn't specify the mount point in the new pool. Also, "zfs receive" will 
automatically mount the received boot environment after it finishes when 
"-u" is not specified. So, there are two ways to fix this, either by 
specifying "-o altroot=/mnt" when "zpool create" or "-u" when "zfs receive".

> 
>>
>> I tried other zfs related commands, all give the same return.
>>
>> Now, I reboot the whole system, I can not even enter the system.
> 
> If you are trying to create a second zfs-root system, based on copying
> the file system from an already-working system, you left out a few
> steps:
> 
> * You only send/received a single boot environment, but there's more
> to the pool than that.  You should do something more like "zfs send -R
> E580@today | zfs receive -F test"
> * You need to set the bootable fs with "zfs set bootfs=test/ROOT/fb14 test"
> * You didn't install the bootloader onto ada1p1.  The details of how
> to do that vary based on whether you are booting with EFI or BIOS.
> 
>>
>> What's the problem? I cannot find any hints with zpool/zfs man page.
>>
>>
>> Best,
>>
>> Jinsong
>>
>>
>>