QEMU 机器类型和兼容性【翻译】

如果您想要将最初在较旧的 QEMU 版本上启动的来宾迁移到较新版本的 QEMU,您需要确保两台机器实际上彼此兼容。一旦排除了根本无法迁移的设备之类的东西,并确保两个 QEMU 调用实际上创建了相同的虚拟硬件,这基本上可以归结为使用兼容的机器。

版本化机器类型

如果你只是想创建一台机器而不考虑迁移兼容性,你通常会这样做

qemu-system-ppc64 -machine pseries (...)

这将创建一个这种pseries类型的机器。但在本例中,pseries
实际上是该机器类型的最新版本的别名;
对于 6.2,这将是
pseries-6.2. 您可以通过以下方式找出哪些机器类型已版本化(以及给定二进制文件实际存在哪些机器类型)-machine ?

$ qemu-system-ppc64 -machine ?
Supported machines are:
40p                  IBM RS/6000 7020 (40p)
bamboo               bamboo
g3beige              Heathrow based PowerMAC
mac99                Mac99 based PowerMAC
mpc8544ds            mpc8544ds
none                 empty machine
pegasos2             Genesi/bPlan Pegasos II
powernv10            IBM PowerNV (Non-Virtualized) POWER10
powernv8             IBM PowerNV (Non-Virtualized) POWER8
powernv              IBM PowerNV (Non-Virtualized) POWER9 (alias of powernv9)
powernv9             IBM PowerNV (Non-Virtualized) POWER9
ppce500              generic paravirt e500 platform
pseries-2.1          pSeries Logical Partition (PAPR compliant)
pseries-2.10         pSeries Logical Partition (PAPR compliant)
pseries-2.11         pSeries Logical Partition (PAPR compliant)
pseries-2.12         pSeries Logical Partition (PAPR compliant)
pseries-2.12-sxxm    pSeries Logical Partition (PAPR compliant)
pseries-2.2          pSeries Logical Partition (PAPR compliant)
pseries-2.3          pSeries Logical Partition (PAPR compliant)
pseries-2.4          pSeries Logical Partition (PAPR compliant)
pseries-2.5          pSeries Logical Partition (PAPR compliant)
pseries-2.6          pSeries Logical Partition (PAPR compliant)
pseries-2.7          pSeries Logical Partition (PAPR compliant)
pseries-2.8          pSeries Logical Partition (PAPR compliant)
pseries-2.9          pSeries Logical Partition (PAPR compliant)
pseries-3.0          pSeries Logical Partition (PAPR compliant)
pseries-3.1          pSeries Logical Partition (PAPR compliant)
pseries-4.0          pSeries Logical Partition (PAPR compliant)
pseries-4.1          pSeries Logical Partition (PAPR compliant)
pseries-4.2          pSeries Logical Partition (PAPR compliant)
pseries-5.0          pSeries Logical Partition (PAPR compliant)
pseries-5.1          pSeries Logical Partition (PAPR compliant)
pseries-5.2          pSeries Logical Partition (PAPR compliant)
pseries-6.0          pSeries Logical Partition (PAPR compliant)
pseries-6.1          pSeries Logical Partition (PAPR compliant)
pseries              pSeries Logical Partition (PAPR compliant) (alias of pseries-6.2)
pseries-6.2          pSeries Logical Partition (PAPR compliant) (default)
ref405ep             ref405ep
sam460ex             aCube Sam460ex
taihu                taihu
virtex-ml507         Xilinx Virtex ML507 reference design

pseries-x.y如您所见,旧版本有多种机器类型;这些旨在提供与使用较旧的 QEMU 版本创建的默认机器兼容的配置。例如,如果您想要迁移在pseries使用 QEMU 5.1 创建的计算机上运行的来宾,则接收 QEMU 需要启动

qemu-system-ppc64 -machine pseries-5.1 (...)

支持的机器类型

注意:以下内容适用于上游 QEMU。发行版可能在其构建中支持不同版本的机器类型。

此列表自 QEMU 6.2 起;将来可能会添加新版本的机器类型,有时旧版本的机器类型会被弃用和删除。下一个 QEMU 版本的机器类型通常在发布周期的早期引入(至少,这是目标......)

arm,aarch64

virt机器类型支持 2.6 以后的版本。

m68k

virt机器类型支持 6.0 以后的版本。

ppc64

pseries机器类型支持 2.1 之后的版本。

s390x

s390-ccw-virtio机器类型支持 2.4 以后的版本。

i386、x86_64

机器pc-i440fx类型支持1.4以后的版本(以前还有更老的版本,但是已经被删除了),而pc-q35机器类型支持2.4以后的版本。

这里还需要考虑另一件事:pc机器类型别名(从 QEMU 6.2 开始)指向最新的pc-i440fx机器类型;如果您想要最新的
pc-q35机器类型,则必须使用q35.

如何使用这个

如果您只想启动 QEMU 实例并再次关闭它,而不希望将其迁移到任何地方,则可以坚持使用默认机器类型。但是,如果您以后可能想要迁移机器,那么明确指定版本化机器类型可能是个好主意,这样您就不必记住启动时使用的 QEMU 版本。

或者直接使用libvirt之类的管理软件,它会自动帮你把机器类型扩展到最新版本,以后就不用担心了。

兼容机种的使用部分就到此结束;后续文章将介绍如何实际实施。

ref:https://people.redhat.com/~cohuck/2022/01/05/qemu-machine-types.html

服务器sata-raid混用模式下热插拔磁盘扩容

用的是惠普dl360服务器,增加了几块磁盘后,发现ubuntu中看不到。

新增6块:
2块保留sata模式
4块组成raid6

查看物理磁盘信息

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0     4K  1 loop /snap/bare/5
loop1    7:1    0  63.4M  1 loop /snap/core20/1974
loop2    7:2    0  63.9M  1 loop /snap/core20/2182
loop3    7:3    0  73.9M  1 loop /snap/core22/858
loop4    7:4    0 237.2M  1 loop /snap/firefox/2987
loop5    7:5    0 349.7M  1 loop /snap/gnome-3-38-2004/143
loop6    7:6    0 485.5M  1 loop /snap/gnome-42-2204/120
loop7    7:7    0   497M  1 loop /snap/gnome-42-2204/141
loop8    7:8    0  91.7M  1 loop /snap/gtk-common-themes/1535
loop9    7:9    0  12.3M  1 loop /snap/snap-store/959
loop10   7:10   0  53.3M  1 loop /snap/snapd/19457
loop11   7:11   0  40.4M  1 loop /snap/snapd/20671
loop12   7:12   0   452K  1 loop /snap/snapd-desktop-integration/83
sda      8:0    0   2.2T  0 disk 
sdb      8:16   0 238.5G  0 disk 
├─sdb1   8:17   0   512M  0 part /boot/efi
└─sdb2   8:18   0   238G  0 part /var/snap/firefox/common/host-hunspell
                                 /
sdc      8:32   0 745.2G  0 disk 
sdd      8:48   0 745.2G  0 disk 
sde      8:64   0   512M  1 disk 
└─sde1   8:65   0 509.8M  1 part /media/zcj/VID

格式化

# 格式化成 Ext4
mkfs.ext4 /dev/vdb1
​
# 格式化为 XFS
apt install xfsprogs
mkfs.xfs /dev/vdb2
​
# 格式化为 Btrfs
apt install btrfs-progs
mkfs.btrfs /dev/vdb3

这里我们选择xfs

sudo mkfs.xfs /dev/sdc
meta-data=/dev/sdc               isize=512    agcount=4, agsize=48838262 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=195353046, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=95387, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.

临时挂载

普通单xfs 磁盘

mount -t xfs /dev/sdc /disk2

raid磁盘

sudo mkfs.xfs /dev/sda
mkfs.xfs: /dev/sda appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.

这里提示无法挂载,有gpt分区表,因为确认是新raid,我们选择强制格式化,加-f参数:
sudo mkfs.xfs -f /dev/sda

df -h 查看挂载结果

永久挂载

vim /etc/fstab

/swapfile                                 none            swap    sw              0       0
/dev/sdc        /disk2          xfs     defaults         0       0
/dev/sdd        /disk3           xfs    defaults          0        0

生效查看:
mount -a

brew git错误

fatal: not in a git directory
Error: Command failed with exit 128: git

首先 网上说的那个git config 是没用的,我是在brew -v 正常的情况下,出现这个错误的,

所以,继续搜索...

解决:
执行 brew doctor,然后按照提示,把所有的warnning消除掉,然后就正常了

brew doctor
Your system is ready to brew.

brew update --verbose
Checking if we need to fetch /opt/homebrew/Homebrew...
Fetching /opt/homebrew/Homebrew...
Checking if we need to fetch formula.jws.json...
Checking if we need to fetch cask.jws.json...
Checking if we need to fetch formula_tap_migrations.jws.json...
Checking if we need to fetch cask_tap_migrations.jws.json...
Already up-to-date.

m1 macbook(arm版通用)安装brew

安装:
cd /opt/homebrew/

/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"

消除告警:
git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-core git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-cask

最后将brew路径写入shell配置 .zshrc
export PATH=$PATH:/opt/homebrew/bin

燕尾蝶

凭着些许的记忆,我找到了《燕尾蝶》,那是少年时的震撼,一直萦绕于心,趁这个春节有空,得以找到资源。重温后,却感觉些许的迷茫,一种破碎记忆的感觉,时间太久远了,记忆已经模糊,感觉就是印象中的故事,又感觉有些生疏,因为印象中没有这么多细节,我只记依稀得移民,黑社会,各种加载的语言,昏暗的画面。。。

一时恍惚。

我又仔细搜索了下,着实找不到第二个能对的上记忆的影片,只能悻悻道,可能就是它吧。

人的记忆是会变的,趁年轻,多写些记忆吧。

如何在windows中模拟arm64安卓系统

quem efi:

https://releases.linaro.org/reference-platform/enterprise/17.12/uefi/release/qemu-aarch64/QEMU_EFI.fd

安卓 iso:

https://developers.google.cn/android/images?hl=zh-cn#crosshatch

quem

pacman 所需的msys2 安装

https://www.qemu.org/download/#windows

For 64 bit Windows 8.1 or above (in UCRT64):

pacman -S mingw-w64-ucrt-x86_64-qemu
qemu-img --version
qemu-img version 8.2.0
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

qemu-system-aarch64