仮想マシンブロックデバイスの問題

仮想マシンブロックデバイスの問題

私のホストコンピュータには2つのブロックデバイスがあり、それを仮想マシンゲストに渡したいと思います。 1つは完全に動作し、もう1つはそうではありません。唯一の違いは、1つは内部ドライブの論理ボリュームで、もう1つは外部Thunderboltドライブに構築されたソフトウェアRAIDにあることです。ホストとゲストが必要な場所にパーティションテーブルがあるかどうかを確認する作業をよりよく行う必要があるかどうか疑問に思います。

ゲストとホストの両方が最新のArch Linuxを実行しています。ホストの最初のデバイスは、/dev/nvme0n1p3Intel NUC13マザーボードに直接接続されているLVMボリュームグループの論理ボリュームにあります。

# fdisk -l /dev/HomeServerNUC13VM/HomeServerNUC13Storage 
Disk /dev/HomeServerNUC13VM/HomeServerNUC13Storage: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: CAEF53EA-821B-4A57-9FFB-E62CE5174E16

Device                                           Start      End  Sectors Size Type
/dev/HomeServerNUC13VM/HomeServerNUC13Storage1    2048  2099199  2097152   1G EFI System
/dev/HomeServerNUC13VM/HomeServerNUC13Storage2 2099200 33552383 31453184  15G Linux filesystem

/dev/md127p12番目は、ソフトウェアRAID 5アレイを持つ他のLVMボリュームグループの論理ボリュームです/dev/nvme{1,2,3,4}n1p1。これらの物理ドライブはすべてエンクロージャ内にあり、Thunderboltを介してNUCに接続されています。

# fdisk -l /dev/HomeStorageOWC/HomeServerNUC13Storage 
Disk /dev/HomeStorageOWC/HomeServerNUC13Storage: 2 TiB, 2199023255552 bytes, 536870912 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 786432 bytes
Disklabel type: gpt
Disk identifier: DBF9C573-63AF-417B-ADE6-F6560D0702D9

Device                                      Start       End   Sectors Size Type
/dev/HomeStorageOWC/HomeServerNUC13Storage1   256 536870655 536870400   2T Linux filesystem

ホストシステムの2つのブロックデバイス上のパーティションにアクセスし、kpartx -a問題なくマウントできます。デバイスを仮想マシンゲストに転送する際に問題が発生する

   <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
      <source dev='/dev/HomeServerNUC13VM/HomeServerNUC13Storage'/>
      <target dev='sda' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
      <source dev='/dev/HomeStorageOWC/HomeServerNUC13Storage'/>
      <target dev='sdb' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

ゲストでは正しく/dev/HomeServerNUC13VM表示され/dev/sda動作しますが、/dev/HomeStorageOWC/HomeServerNUC13Storageゲストでは/dev/sdb混乱しているようです。Disklabel typeありますので参考にしてくださいdos

# fdisk -l /dev/sdb
GPT PMBR size mismatch (536870911 != 4294967295) will be corrected by write.
Disk /dev/sdb: 2 TiB, 2199023255552 bytes, 4294967296 sectors
Disk model: QEMU HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdb1           1 4294967295 4294967295   2T ee GPT

ゲストがパーティションテーブルとパーティションを再作成すると、ゲストはすべて正常です。

# fdisk -l /dev/sdb
Disk /dev/sdb: 2 TiB, 2199023255552 bytes, 4294967296 sectors
Disk model: QEMU HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 00B06790-6D3B-4694-B435-6E9E6E9E12CB

Device     Start        End    Sectors Size Type
/dev/sdb1   2048 4294965247 4294963200   2T Linux filesystem

しかし、コンソールに戻ると状況がめちゃくちゃになりました。Disklabel typeはい、またdos

# fdisk -l /dev/HomeStorageOWC/HomeServerNUC13Storage 
Disk /dev/HomeStorageOWC/HomeServerNUC13Storage: 2 TiB, 2199023255552 bytes, 536870912 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 786432 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device                                      Boot Start        End    Sectors Size Id Type
/dev/HomeStorageOWC/HomeServerNUC13Storage1          1 4294967295 4294967295  16T ee GPT

Partition 1 does not start on physical sector boundary.

RAID 5を削除して/dev/nvme{1,2,3,4}n1LVMを直接デプロイしている間/dev/md127(つまりパーティションなし)、自分で再作成してからLVを256GBに設定しましたが、まだ同じ問題が発生します。

ベストアンサー1

答えは嘘ですlibvirt ドキュメント、特に次の行で:

blockio logical_block_size='512' physical_block_size='4096'
discard_granularity='4096'

QEMUには次のオプションもあります。

- デバイスscsi-hd、バス= scsi1.0、ドライブ=drive-virtio-disk1、id=virtio-scsi-pci1、物理ブロックサイズ = 4096、論理ブロックサイズ = 512

おすすめ記事