From owner-freebsd-questions@freebsd.org Thu Jun 15 03:24:37 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D09CDBFEC97 for ; Thu, 15 Jun 2017 03:24:37 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from holgerdanske.com (holgerdanske.com [IPv6:2001:470:0:19b::b869:801b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "holgerdanske.com", Issuer "holgerdanske.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BAD5B965 for ; Thu, 15 Jun 2017 03:24:37 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from 99.100.19.101 ([99.100.19.101]) by holgerdanske.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username dpchrist@holgerdanske.com, mechanism PLAIN) for ; Wed, 14 Jun 2017 20:24:36 -0700 Subject: Re: FreeBSD 11.0 boot pool created by installer -- how to import and mount using installer? To: freebsd-questions@freebsd.org References: <1fb7f3d1-dfb5-ab75-ab75-12dcc81423ca@holgerdanske.com> <39a436b5-f09e-220b-954d-8ba272fa3101@holgerdanske.com> <51d6f981-a763-cdd0-648f-c36f2d757334@mailman-hosting.com> From: David Christensen Message-ID: Date: Wed, 14 Jun 2017 20:23:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jun 2017 03:24:37 -0000 On 06/14/2017 05:42 PM, Jim Ohlstein wrote: > Hello, > > On 06/14/2017 08:39 PM, David Christensen wrote: >> On 06/14/2017 05:08 PM, Jim Ohlstein wrote: >>> On 06/14/2017 08:03 PM, David Christensen wrote: >>>> freebsd-questions: >>>> >>>> I have a FreeBSD 11.0 RELEASE i386 system that I created using the >>>> FreeBSD installer (FreeBSD-11.0-RELEASE-i386-memstick.img): >>>> >>>> Partitioning Auto (ZFS) >>>> >>>> ZFS Configuration >>>> Pool Type/Disks Stripe 1 Disk >>>> Virtual Device type stripe >>>> (device) ada0 >>>> Pool Name zroot >>>> Force 4K Sectors YES >>>> Encrypt Disks YES >>>> Partition Scheme MBR (BIOS) >>>> Swap Size 2g >>>> Mirror Swap NO >>>> Encrypt Swap YES >>>> Install Proceed with Installation >>>> >>>> I broke the system by attempting to change the root pool passphrase. >>>> I might be able to fix it if I can edit /boot/loader.conf. >>>> >>>> Booting the FreeBSD installer into multi-user mode and then going to a >>>> shell: >>>> >>>> # zpool list >>>> no pools available >>>> >>>> # zpool import >>>> pool: bootpool >>>> id: >>>> state: ONLINE >>>> action: The pool can be imported using its name or numeric >>>> identifier. >>>> config: >>>> >>>> bootpool ONLINE >>>> ada0s1a ONLINE >>>> >>>> # zpool import bootpool >>>> cannot import 'bootpool': pool may be in use from other system >>>> use '-f' to import anyway >>>> >>>> # zpool import -f bootpool >>>> cannot mount '/bootpool': failed to created mountpoint >>>> >>>> Choosing Live CD produces the same end result. >>>> >>>> I previously obtained the same end result by booting into single-user >>>> mode. >>>> >>>> How do I import and mount bootpool using the installer that created it? >>> >>> Try >>> >>> # zpool import -f -o mountpoint=/mnt bootpool >> >> Thanks for the reply. >> >> >> Booting FreeBSD 11.0 RELEASE i386 installer into single-user mode and >> accepting default shell: >> >> # zpool import -f -o mountpoint=/mnt bootpool >> ZFS NOTICE: KSTACK_PAGES is 2 which could result in stack overflow panic! >> Please consider adding 'options KSTACK_PAGES=4' to your kernel config >> ZFS NOTICE: Prefetch is disabled by default on i386 -- to enable, add >> "vfs.zfs.prefetch_disable=0" to /boot/loader.conf. >> ZFS WARNING: Recommended minimum kmem_size is 512 MB; expect unstable >> behavior. Consider tuning vm.kmem_size and vm.kmem_size_max in >> /boot/loader.conf. >> ZFS filesystem version: 5 >> ZFS storage pool version: features support (5000) >> property 'mountpoint' is not a valid pool property > > Hmmm.... That's odd. > > # zfs get mountpoint zroot > NAME PROPERTY VALUE SOURCE > zroot mountpoint /zroot local 1. zfs(8) is not the same as zpool(8). You used the former; I used the latter. 2. "mountpoint" is a ZFS Native Property, not a ZFS pool property: http://docs.oracle.com/cd/E23824_01/html/821-1448/gazss.html#gcfgr https://docs.oracle.com/cd/E19120-01/open.solaris/817-2271/6mhupg6jv/index.html#gfiex 3. The installer environment is going to be different than a "normal" FreeBSD system. Digging some more: # mount /dev/ufs/FreeBSD_Install on / (ufs, local, noatime, read-only) devfs on /dev (devfs, local, multilabel) /dev/md0 on /var (ufs, local) /dev/md1 on /tmp (ufs, local) So, the installer provides a read-only root file system, overlaid with a devfs for /dev, a memory file system for /var, and a memory file system for /tmp. Perhaps if I create a mount point within /tmp, since it's writable, and then import bootpool using an alternate root: http://docs.oracle.com/cd/E19253-01/819-5461/gbcgl/index.html # mkdir /tmp/bootpool # zpool import -R /tmp/bootpool bootpool # zpool list bootpool NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT bootpool 1.98G 128M 1.86G - 7% 6% 1.00x ONLINE /tmp/bootpool Now I can edit loader.conf: # cd /tmp/bootpool/bootpool/boot # ls -l loader.conf -rw-r--r-- 1 root wheel 517 Jan 25 19:36 loader.conf # cp loader.conf loader.con-20170125-1936 # vi loader.conf ### 20170614 dpchrist - don't use keyfile for root pool #geli_ada0s1d_keyfile0_load="YES" #geli_ada0s1d_keyfile0_type="ada0s1d:geli_keyfile0" #geli_ada0s1d_keyfile0_name="/boot/encryption.key" Change directory out and export the pool: # cd # pwd / # zpool export bootpool # zpool list no pools available Power down, pull the installer USB flash drive, and boot -- it works! One last step: toor@freebsd:/boot # zpool import bootpool Reboot -- everything is there: toor@freebsd:~ # zpool list NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT bootpool 1.98G 128M 1.86G - 7% 6% 1.00x ONLINE - zroot 10.9G 5.11G 5.76G - 45% 47% 1.00x ONLINE - toor@freebsd:~ # mount | egrep '^(zroot |bootpool)' bootpool on /bootpool (zfs, local, nfsv4acls) zroot on /zroot (zfs, local, noatime, nfsv4acls) Thanks everyone for the help. :-) David