找回密码
 注册
查看: 711|回复: 1

qcow2镜像文件瘦身 配置

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-6-28 15:02:49 | 显示全部楼层 |阅读模式
qcow2镜像文件瘦身 配置
& q5 ~7 M: a6 B+ E
2 Q. e, H7 {* d" O" F) l9 Z8 ^
使用dd命令将客户机未使用的磁盘空间用0填满
% l9 D4 H. U0 }3 |; l& E
$dd if=/dev/zero of=~/junk

" D% f* V5 o& i2 n% ?: K
dd: writing to `/home/***/junk’: No space left on device

0 K1 b/ d0 a) _5 h' S
而后

0 @- Q1 r; S: \& }
$rm junk
# j+ W2 J  y$ {# |# v
关闭客户机

- Z; q! G' a! _$ E
  i/ ]$ G$ N# X1 x2 z& I

" ^1 Z, {' \% e

$ G1 N% C( E* K1 y9 s9 o0 F

# K6 A- d+ l% Q% {( [
qemu-img check debian.qcow2
. n# j- N# C  [# @  o* p  t) BNo errors were found on the image.4 [( o  B2 |$ L
74133/81920 = 90.49% allocated, 0.00% fragmented, 0.00% compressed clusters
! @( L! ]9 B  @8 E( M' Y* l" XImage end offset: 4859428864
. I' v" ^0 H3 s/ h+ _
[root@controller src]# qemu-img convert -c  -O qcow2 debian.qcow2 debian.qcow2.qcow2
% V( q" X# v8 N) P* S
' S! a  N1 u1 V7 D: v) c" M" {- S+ s  ]

' P1 x1 J) X4 w5 c$ l; n
: B  q! ^* }4 S4 l5 t) d+ d% \0 x* [

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-6-28 15:10:24 | 显示全部楼层
[root@controller src]# qemu-img check debian.qcow2.qcow2 5 z0 _5 _* ~, g  x# `  F
No errors were found on the image.
! U, N7 @' P; |74133/81920 = 90.49% allocated, 35.09% fragmented, 34.67% compressed clusters' i7 U8 ^0 J. F' o/ F% }1 B" q
Image end offset: 3747151872
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:52 , Processed in 0.028381 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表