両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン |
linux:qemu-kvm:qemu-img [2023/09/01 07:37] – ともやん | linux:qemu-kvm:qemu-img [2024/07/07 16:28] (現在) – [参考文献] ともやん |
---|
<WRAP color_command><html><pre> | <WRAP color_command><html><pre> |
<b class=GRN>$</b> <b class=HIY>sudo</b> qemu-img convert <b class=HIK>-O</b> raw filename.vmdk filename.img | <b class=GRN>$</b> <b class=HIY>sudo</b> qemu-img convert <b class=HIK>-O</b> raw filename.vmdk filename.img |
| </pre></html></WRAP> |
| </WRAP> |
| |
| ===== Linux で qcow2 ディスクイメージをマウントする方法 ===== |
| 参考: [[https://gist.github.com/shamil/62935d9b456a6f9877b5|How to mount a qcow2 disk image]]\\ |
| |
| ホスト上で NBD を有効にして、QCOW2 を NBD として接続する🤔\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">modprobe</font> nbd max_part=8 |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">qemu-nbd</font> <font color="#A347BA">--connect=/dev/nbd0</font> <u style="text-decoration-style:solid">/var/lib/libvirt/images/Windows_10_Pro_x64.qcow2</u> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">fdisk</font> <u style="text-decoration-style:solid">/dev/nbd0</u> <font color="#A347BA">-l</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| <b>Disk /dev/nbd0: 256 GiB, 274877906944 bytes, 536870912 sectors</b> |
| 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: 0x4ac41c2f |
| |
| <b>Device </b> <b>Boot</b> <b> Start</b> <b> End</b> <b> Sectors</b> <b> Size</b> <b>Id</b> <b>Type</b> |
| /dev/nbd0p1 * 2048 206847 204800 100M 7 HPFS/NTFS/exFAT |
| /dev/nbd0p2 206848 536868863 536662016 255.9G 7 HPFS/NTFS/exFAT |
| </pre></html></WRAP> |
| </WRAP> |
| |
| NBD を切断する🤔\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">qemu-nbd</font> <font color="#A347BA">--disconnect</font> <u style="text-decoration-style:solid">/dev/nbd0</u> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| /dev/nbd0 disconnected |
| </pre></html></WRAP> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">rmmod</font> nbd |
</pre></html></WRAP> | </pre></html></WRAP> |
</WRAP> | </WRAP> |
[[https://pve.proxmox.com/wiki/Shrink_Qcow2_Disk_Files|Shrink Qcow2 Disk Files - Proxmox VE]]\\ | [[https://pve.proxmox.com/wiki/Shrink_Qcow2_Disk_Files|Shrink Qcow2 Disk Files - Proxmox VE]]\\ |
[[https://unix.stackexchange.com/questions/612888/tell-if-a-file-is-a-sparse-file|There is an existing question for "Finding all sparse files", and I think I could use it, but the scripts were too complex to understand. I don't think the GUI of Ubuntu file manager prov...]]\\ | [[https://unix.stackexchange.com/questions/612888/tell-if-a-file-is-a-sparse-file|There is an existing question for "Finding all sparse files", and I think I could use it, but the scripts were too complex to understand. I don't think the GUI of Ubuntu file manager prov...]]\\ |
| [[https://superuser.com/questions/72152/windows-7-fails-to-install-on-kvm-with-qemu|ubuntu - Windows 7 fails to install on KVM with qemu - Super User]]\\ |
| [[https://askubuntu.com/questions/1310440/using-virtio-win-drivers-with-win7-sp1-x64|virtualization - Using virtio-win drivers with Win7 SP1 x64 - Ask Ubuntu]]\\ |
| |
==== 付録 ==== | ==== 付録 ==== |
[[tw>tomoyan596/status/1465803218206617605|KVMの中で飼いならします🤤]]\\ | [[tw>tomoyan596/status/1465803218206617605|KVMの中で飼いならします🤤]]\\ |
[[tw>tomoyan596sp/status/1697355608306209081|スパースファイルの整理はこんなところにしてたのかぁ🤔記憶にはあるけど...どこに行ったかわからなくなってたり...😅]]\\ | [[tw>tomoyan596sp/status/1697355608306209081|スパースファイルの整理はこんなところにしてたのかぁ🤔記憶にはあるけど...どこに行ったかわからなくなってたり...😅]]\\ |