From owner-freebsd-questions@freebsd.org Sat Jun 1 18:50:09 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43B6515C32BA for ; Sat, 1 Jun 2019 18:50:09 +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 7E50672A0D for ; Sat, 1 Jun 2019 18:50:08 +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 ; Sat, 1 Jun 2019 11:50:04 -0700 Subject: Re: error when mounting md0 invalid argument To: freebsd-questions@freebsd.org References: From: David Christensen Message-ID: <0bf3fbee-fe2a-ae2a-116e-09ac82cb18eb@holgerdanske.com> Date: Sat, 1 Jun 2019 11:50:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jun 2019 18:50:09 -0000 On 6/1/19 5:04 AM, David Mehler wrote: > On 5/31/19, David Christensen wrote: >> On 5/31/19 5:29 AM, David Mehler wrote: >>> I've got a copy of the FreeBSD 12.0 memstick img file. I'm trying >>> to mount it to make some changes to allow it to go serial >>> terminal by default. >> FreeBSD-11.2-RELEASE-amd64-memstick.img >> >> I burned the image to a USB flash drive and then mounted it: > Hi, > > Thanks, that helped. > > What alterations did you have to make? > > Thanks. Dave. I wanted system images to fit "16 GB" SSD's and USB flash drives, with wiggle room at the end to facilitate image migration: MBR scheme 14g slice 1g boot 1g swap 12g root free space Some of the above can be achieved via the FreeBSD 11.2 installer user interface, but others require changes to the installer script: 2019-06-01 11:28:11 toor@soho ~/FreeBSD-11.2-RELEASE-amd64-memstick/usr/libexec/bsdinstall # cvs diff -r 1.1 zfsboot Index: zfsboot =================================================================== RCS file: /var/local/cvs/dpchrist/FreeBSD-11.2-RELEASE-amd64-memstick/usr/libexec/bsdinstall/zfsboot,v retrieving revision 1.1 retrieving revision 1.7 diff -r1.1 -r1.7 50c50 < : ${ZFSBOOT_POOL_CREATE_OPTIONS:=-O compress=lz4 -O atime=off} --- > : ${ZFSBOOT_POOL_CREATE_OPTIONS:=-O compress=lz4 -O atime=off -O copies=2} 92c92 < : ${ZFSBOOT_BOOT_POOL_CREATE_OPTIONS:=} --- > : ${ZFSBOOT_BOOT_POOL_CREATE_OPTIONS:=-O copies=2} 102c102 < : ${ZFSBOOT_BOOT_POOL_SIZE:=2g} --- > : ${ZFSBOOT_BOOT_POOL_SIZE:=1g} 123c123 < : ${ZFSBOOT_SWAP_SIZE:=2g} --- > : ${ZFSBOOT_SWAP_SIZE:=1g} 133c133 < : ${ZFSBOOT_SWAP_MIRROR=} --- > : ${ZFSBOOT_SWAP_MIRROR=YES} 196a197 > GPART_ADD_ALIGN_WITH_SIZE='gpart add %s -t %s -s %s "%s"' 953c954 < # 2. Add freebsd slice with all available space --- > # 2. Add freebsd slice with size 14g 955,956c956,957 < f_eval_catch $funcname gpart "$GPART_ADD_ALIGN" "$align_small" \ < freebsd $disk || --- > f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_WITH_SIZE" "$align_small" \ > freebsd 14g $disk || 1000c1001 < "$align_small" 2 freebsd-swap ${swapsize}b ${disk}s1 || --- > "$align_big" 2 freebsd-swap ${swapsize}b ${disk}s1 || 1011c1012 < "$align_small" $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE --- > "$align_big" $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE Here is the result: 2019-06-01 11:28:17 toor@soho ~/FreeBSD-11.2-RELEASE-amd64-memstick/usr/libexec/bsdinstall # gpart show -p ada0 ada0s1 => 63 31277169 ada0 MBR (15G) 63 1 - free - (512B) 64 29360128 ada0s1 freebsd [active] (14G) 29360192 1917040 - free - (936M) => 0 29360128 ada0s1 BSD (14G) 0 2097152 ada0s1a freebsd-zfs (1.0G) 2097152 1984 - free - (992K) 2099136 2097152 ada0s1b freebsd-swap (1.0G) 4196288 25163776 ada0s1d freebsd-zfs (12G) 29360064 64 - free - (32K) That almost meets my goals, and will work on 4K drives. (I changed "$align_small" to "$align_big" on lines 1001 and 1012, but missed line 956. This caused the free spaces within the slice. I need to change line 956.) David