An example of installing the 13.1-RELEASE image for aarch64 RPI* but with a swap partition: steps to follow
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 09 Nov 2022 03:48:11 UTC
Note: Some details below are MBR specific (matching the original image) Note: I have included frequent "gpart show" or "gpart show -p" commands and output. To get started I put the image on a 32 GiByte microsd card: # dd if=FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img of=/dev/da4 bs=1m conv=fsync,sync status=progress After it finished . . . Boot to the microsd card, stopping in the loader to boot in a way that stops before the growfs but allows adjusting things: Hit [Enter] to boot immediately, or any other key for command prompt. Booting [/boot/kernel/kernel] in 9 seconds... Type '?' for a list of commands, 'help' for more detailed help. OK boot -s . . . Enter full pathname of shell or RETURN for /bin/sh: root@:/ # gpart show => 63 62333889 mmcsd0 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 1 fat32lba [active] (50M) 104391 6187041 2 freebsd (3.0G) 6291432 56042520 - free - (27G) => 0 6187041 mmcsd0s2 BSD (3.0G) 0 57 - free - (29K) 57 6186880 1 freebsd-ufs (2.9G) 6186937 104 - free - (52K) => 63 62333889 diskid/DISK-D8900C35 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 1 fat32lba [active] (50M) 104391 6187041 2 freebsd (3.0G) 6291432 56042520 - free - (27G) => 0 6187041 diskid/DISK-D8900C35s2 BSD (3.0G) 0 57 - free - (29K) 57 6186880 1 freebsd-ufs (2.9G) 6186937 104 - free - (52K) # ls -Tld /dev/ufs/* crw-r----- 1 root operator 0x5e Nov 4 04:48:18 2022 /dev/ufs/rootfs root@:/ # gpart resize -i2 /dev/mmcsd0 GEOM_PART: mmcsd0s2 was automatically resized. Use `gpart commit mmcsd0s2` to save changes or `gpart undo mmcsd0s2` to revert them. mmcsd0s2 resized root@:/ # gpart commit mmcsd0s2 root@:/ # gpart show => 63 62333889 mmcsd0 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 1 fat32lba [active] (50M) 104391 62228537 2 freebsd (30G) 62332928 1024 - free - (512K) => 0 62228537 mmcsd0s2 BSD (30G) 0 57 - free - (29K) 57 6186880 1 freebsd-ufs (2.9G) 6186937 56041600 - free - (27G) => 63 62333889 diskid/DISK-D8900C35 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 1 fat32lba [active] (50M) 104391 62228537 2 freebsd (30G) 62332928 1024 - free - (512K) => 0 62228537 diskid/DISK-D8900C35s2 BSD (30G) 0 57 - free - (29K) 57 6186880 1 freebsd-ufs (2.9G) 6186937 56041600 - free - (27G) root@:/ # # Ballpark: 3.0G + 27G - 3.5G == 26.5G == 26.5*1024*M == 27136M root@:/ # gpart resize -i1 -s27136M /dev/mmcsd0s2 mmcsd0s2a resized root@:/ # # gpart show -p => 63 62333889 mmcsd0 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 mmcsd0s1 fat32lba [active] (50M) 104391 62228537 mmcsd0s2 freebsd (30G) 62332928 1024 - free - (512K) => 0 62228537 mmcsd0s2 BSD (30G) 0 57 - free - (29K) 57 55574528 mmcsd0s2a freebsd-ufs (27G) 55574585 6653952 - free - (3.2G) => 63 62333889 diskid/DISK-D8900C35 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 diskid/DISK-D8900C35s1 fat32lba [active] (50M) 104391 62228537 diskid/DISK-D8900C35s2 freebsd (30G) 62332928 1024 - free - (512K) => 0 62228537 diskid/DISK-D8900C35s2 BSD (30G) 0 57 - free - (29K) 57 55574528 diskid/DISK-D8900C35s2a freebsd-ufs (27G) 55574585 6653952 - free - (3.2G) root@:/ # gpart add -tfreebsd-swap /dev/mmcsd0s2 mmcsd0s2b added root@:/ # gpart show -p => 63 62333889 mmcsd0 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 mmcsd0s1 fat32lba [active] (50M) 104391 62228537 mmcsd0s2 freebsd (30G) 62332928 1024 - free - (512K) => 0 62228537 mmcsd0s2 BSD (30G) 0 57 - free - (29K) 57 55574528 mmcsd0s2a freebsd-ufs (27G) 55574585 2048 - free - (1.0M) 55576633 6651904 mmcsd0s2b freebsd-swap (3.2G) => 63 62333889 diskid/DISK-D8900C35 MBR (30G) 63 2016 - free - (1.0M) 2079 102312 diskid/DISK-D8900C35s1 fat32lba [active] (50M) 104391 62228537 diskid/DISK-D8900C35s2 freebsd (30G) 62332928 1024 - free - (512K) => 0 62228537 diskid/DISK-D8900C35s2 BSD (30G) 0 57 - free - (29K) 57 55574528 diskid/DISK-D8900C35s2a freebsd-ufs (27G) 55574585 2048 - free - (1.0M) 55576633 6651904 diskid/DISK-D8900C35s2b freebsd-swap (3.2G) root@:/ # exit Setting hostuuid: . . . Setting hostid: . . . Fast boot: skipping disk checks. Growing root partition to fill device mmcsd0s2 resized mmcsd0s2a resized gpart: arg0 'ufs/rootfs': Invalid argument super-block backups (for fsck_ffs -b #) at: . . . root@generic:~ # df -m Filesystem 1M-blocks Used Avail Capacity Mounted on /dev/ufs/rootfs 26273 2834 21336 12% / devfs 0 0 0 100% /dev /dev/msdosfs/MSDOSBOOT 49 24 25 49% /boot/msdos tmpfs 7663 0 7663 0% /tmp root@generic:~ # ls -Tld /dev/ufs/* crw-r----- 1 root operator 0x5e Nov 4 05:08:54 2022 /dev/ufs/rootfs root@generic:~ # echo "/dev/mmcsd0s2b none swap sw 0 0" >> /etc/fstab root@generic:~ # swapon -a swapon: adding /dev/mmcsd0s2b as swap device root@generic:~ # swapinfo Device 1K-blocks Used Avail Capacity /dev/mmcsd0s2b 3325952 0 3325952 0% root@generic:~ # more /etc/fstab # Custom /etc/fstab for FreeBSD embedded images /dev/ufs/rootfs / ufs rw 1 1 /dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0 tmpfs /tmp tmpfs rw,mode=1777 0 0 /dev/mmcsd0s2b none swap sw 0 0 I've not done anything above to use a label instead of the hard coded /dev/mmcsd0s2b reference. So this would not boot nicely via a USB reader instead of the microsd card slot being used: different device name. So . . . root@generic:~ # glabel label -v swapspace /dev/mmcsd0s2b Metadata value stored on /dev/mmcsd0s2b. Done. root@generic:~ # vi /etc/fstab root@generic:~ # more /etc/fstab # Custom /etc/fstab for FreeBSD embedded images /dev/ufs/rootfs / ufs rw 1 1 /dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0 tmpfs /tmp tmpfs rw,mode=1777 0 0 /dev/label/swapspace none swap sw 0 0 root@generic:~ # shutdown -r now . . . root@generic:~ # swapinfo Device 1K-blocks Used Avail Capacity /dev/label/swapspace 3325948 0 3325948 0% === Mark Millard marklmi at yahoo.com