这将在 Ubuntu 20.04 amd64 主机、QEMU 4.2.1 上启动:
wget https://download.freebsd.org/ftp/releases/VM-IMAGES/12.1-RELEASE/amd64/Latest/FreeBSD-12.1-RELEASE-amd64.qcow2.xz
unxz FreeBSD-12.1-RELEASE-amd64.qcow2.xz
sudo apt install qemu-system-x86
qemu-system-x86_64 -drive file=FreeBSD-12.1-RELEASE-amd64.qcow2,format=qcow2 -enable-kvm
用户名是root
密码为空:
该图像的下载页面是:https://www.freebsd.org/where.html https://www.freebsd.org/where.html
不幸的是,试图添加:
-serial mon:stdio -nographic
摆脱 GUI https://stackoverflow.com/questions/6710555/how-to-use-qemu-to-run-a-non-gui-os-on-the-terminal仅在终端上显示引导加载程序图像,而不显示引导的其余部分。https://lists.freebsd.org/pipermail/freebsd-hackers/2005-March/011051.html https://lists.freebsd.org/pipermail/freebsd-hackers/2005-March/011051.html提到如何通过修改图像来解决这个问题,这很烦人,但有效。在 GUI 启动时,我做了:
echo 'console="comconsole"' > /boot/loader.conf
然后下一个 nographic 启动在我的终端上完全正常工作。
您可以退出 QEMU-nographic
with Ctrl-A X
如图所示:https://superuser.com/questions/1087859/how-to-quit-the-qemu-monitor-when-not-using-a-gui/1211516#1211516 https://superuser.com/questions/1087859/how-to-quit-the-qemu-monitor-when-not-using-a-gui/1211516#1211516
下一个问题是磁盘已满,我必须学会增加其大小。来自互动df -Th
检查,图像似乎包含单个原始UFS https://en.wikipedia.org/wiki/Unix_File_System分割。我试过:
qemu-img resize FreeBSD-12.1-RELEASE-amd64.qcow2 +1G
但这还不够,可能是因为分区本身没有调整大小以适应磁盘。这可能可以通过以下方式实现gpart
如图所示:https://www.freebsd.org/doc/handbook/disks-having.html https://www.freebsd.org/doc/handbook/disks-growing.html但我现在没有耐心。