error when mounting md0 invalid argument

David Christensen dpchrist at holgerdanske.com
Sat Jun 1 18:50:09 UTC 2019


On 6/1/19 5:04 AM, David Mehler wrote:
> On 5/31/19, David Christensen <dpchrist at holgerdanske.com> 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 at 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 at 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


More information about the freebsd-questions mailing list