linux:qemu-kvm:qemu-img

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
linux:qemu-kvm:qemu-img [2023/09/01 06:46] – [付録] ともやんlinux:qemu-kvm:qemu-img [2023/09/01 07:37] (現在) ともやん
行 33: 行 33:
  
 ===== 仮想ディスクの拡張 ===== ===== 仮想ディスクの拡張 =====
-<code+<WRAP color_term
-$ sudo qemu-img resize filename.qcow2 +256G +<WRAP color_command><html><pre> 
-</code+<b class=GRN>$</b> <b class=HIY>sudo</b> qemu-img resize filename.qcow2 +256G 
-<code>+</pre></html></WRAP
 +<WRAP color_result><code>
 Image resized. Image resized.
-</code>+</code></WRAP> 
 +</WRAP> 
 仮想ディスクの容量確認 仮想ディスクの容量確認
-<code+<WRAP color_term
-$ sudo qemu-img info filename.qcow2 +<WRAP color_command><html><pre> 
-</code+<b class=GRN>$</b> <b class=HIY>sudo</b> qemu-img info filename.qcow2 
-<code>+</pre></html></WRAP
 +<WRAP color_result><code>
 image: filename.qcow2 image: filename.qcow2
 file format: qcow2 file format: qcow2
行 54: 行 58:
     refcount bits: 16     refcount bits: 16
     corrupt: false     corrupt: false
-</code>+</code></WRAP> 
 +</WRAP>
  
 ===== 仮想ディスクイメージの圧縮 ===== ===== 仮想ディスクイメージの圧縮 =====
 仮想ディスクイメージの圧縮 (Shrink) とは、仮想ディスクイメージ内の使われなくなった領域を開放し、イメージサイズをコンパクトにして物理ディスク領域も開放する。\\ 仮想ディスクイメージの圧縮 (Shrink) とは、仮想ディスクイメージ内の使われなくなった領域を開放し、イメージサイズをコンパクトにして物理ディスク領域も開放する。\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-ll +<b class=GRN>#</b> <b class=HIY>ls</b> <b class=HIK>-al</b> 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><code> <WRAP color_result><code>
 合計 30426336 合計 30426336
 -rw-------. 1 root root 274920112128 12月  2 16:18 Windows_10_Pro_x64.qcow2 -rw-------. 1 root root 274920112128 12月  2 16:18 Windows_10_Pro_x64.qcow2
 </code></WRAP> </code></WRAP>
-</WRAP> 
  
-<WRAP color_term> +<WRAP color_command><html><pre
-<WRAP color_command><code+<b class=GRN>#</b> <b class=HIY>qemu-img</b> info Windows_10_Pro_x64.qcow2 
-# qemu-img info Windows_10_Pro_x64.qcow2 +</pre></html></WRAP>
-</code></WRAP>+
 <WRAP color_result><code> <WRAP color_result><code>
 image: Windows_10_Pro_x64.qcow2 image: Windows_10_Pro_x64.qcow2
行 92: 行 95:
 [[wpjp>スパースファイル|スパースファイル - Wikipedia]]\\ [[wpjp>スパースファイル|スパースファイル - Wikipedia]]\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-# pwd +<b class=GRN>#</b> <b class=HIY>pwd</b> 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><code> <WRAP color_result><code>
 /var/lib/libvirt/images /var/lib/libvirt/images
 </code></WRAP> </code></WRAP>
-<WRAP color_command><code+<WRAP color_command><html><pre
-# ls -l --block-size=g +<b class=GRN>#</b> <b class=HIY>ls</b> <b class=HIK>-l --block-size=g</b> 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><code> <WRAP color_result><code>
 合計 13G 合計 13G
行 110: 行 113:
  
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-# df -BG +<b class=GRN>#</b> <b class=HIY>df</b> <b class=HIK>-BG</b> 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><code> <WRAP color_result><code>
 ファイルシス   1G-ブロック  使用 使用可 使用% マウント位置 ファイルシス   1G-ブロック  使用 使用可 使用% マウント位置
行 126: 行 129:
 </code></WRAP> </code></WRAP>
 </WRAP> </WRAP>
- 
  
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-# find . -type f -printf "%S\t%p\n" | gawk '$1 1.0 {print}' +<b class=GRN>#</b> <b class=HIY>find</b> <b class=HIK>-type</b> <b class=HIK>-printf</b> "%S\t%p\n"<b class=HIY>gawk</b> '$1 &lt; 1.0 {print}' 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><code> <WRAP color_result><code>
 0.0416002 ./Windows_10_Pro_x64.qcow2 0.0416002 ./Windows_10_Pro_x64.qcow2
 0.00872493 ./fedora35_minimal.qcow2 0.00872493 ./fedora35_minimal.qcow2
 </code></WRAP> </code></WRAP>
-<WRAP color_command><code+<WRAP color_command><html><pre
-# qemu-img info filename.qcow2  +<b class=GRN>#</b> <b class=HIY>qemu-img</b> info filename.qcow2  
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><code> <WRAP color_result><code>
 image: filename.qcow2 image: filename.qcow2
行 157: 行 159:
 ==== 圧縮方法 ==== ==== 圧縮方法 ====
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-# qemu-img convert -O qcow2 Windows_10_Pro_x64.qcow2 Windows_10_Pro_x64.qcow2_shrink +<b class=GRN>#</b> <b class=HIY>qemu-img</b> convert -O qcow2 Windows_10_Pro_x64.qcow2 Windows_10_Pro_x64.qcow2_shrink 
-</code></WRAP> +<b class=GRN>#</b<b class=HIY>ls</b> <b class=HIK>-al</b
-<WRAP color_command><code+</pre></html></WRAP>
-# ll +
-</code></WRAP>+
 <WRAP color_result><code> <WRAP color_result><code>
 合計 30426336 合計 30426336
行 171: 行 171:
  
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-# qemu-img convert -O qcow2 -c Windows_10_Pro_x64.qcow2 Windows_10_Pro_x64.qcow2_shrink-c +<b class=GRN>#</b> <b class=HIY>qemu-img</b> convert <b class=HIK>-O</b> qcow2 <b class=HIK>-c</b> Windows_10_Pro_x64.qcow2 Windows_10_Pro_x64.qcow2_shrink-c 
-</code></WRAP> +</pre></html></WRAP> 
-<WRAP color_command><code+<WRAP color_command><html><pre
-ll +<b class=GRN>#</b> <b class=HIY>ls</b> <b class=HIK>-al</b> 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><code> <WRAP color_result><code>
 合計 30426336 合計 30426336
行 189: 行 189:
 ※ qcow2 形式は必要に応じて膨らむので、実際に使われている容量のファイルができあがる。\\ ※ qcow2 形式は必要に応じて膨らむので、実際に使われている容量のファイルができあがる。\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-$ sudo qemu-img convert -O qcow2 filename.vmdk filename.qcow2 +<b class=GRN>$</b> <b class=HIY>sudo</b> qemu-img convert <b class=HIK>-O</b> qcow2 filename.vmdk filename.qcow2 
-</code></WRAP>+</pre></html></WRAP>
 </WRAP> </WRAP>
  
行 197: 行 197:
 ※ vmdk で定義されているディスク容量(使われていない領域を含む)の raw イメージができあがる。\\ ※ vmdk で定義されているディスク容量(使われていない領域を含む)の raw イメージができあがる。\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-$ sudo qemu-img convert -O 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 
-</code></WRAP>+</pre></html></WRAP>
 </WRAP> </WRAP>
  
  • linux/qemu-kvm/qemu-img.1693518388.txt.gz
  • 最終更新: 2023/09/01 06:46
  • by ともやん