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

qcow2镜像文件瘦身 配置

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-6-28 15:02:49 | 显示全部楼层 |阅读模式
qcow2镜像文件瘦身 配置/ x/ ~0 Z) z0 [( y  z% e
5 L+ R( f0 Y& h4 r7 O
使用dd命令将客户机未使用的磁盘空间用0填满

9 I! h- x9 H& {
$dd if=/dev/zero of=~/junk

7 u# g7 F5 K( r! I) P
dd: writing to `/home/***/junk’: No space left on device
, n% y. G0 O1 J5 G
而后
3 G6 w+ X1 F% X2 A
$rm junk
" o& U( u$ O7 D0 h
关闭客户机

% M9 Z+ a# s. `9 [0 q

2 k6 g- x* P  Q6 \* ~7 @
; K$ B4 n4 Q$ }9 F
! |$ ~$ ]+ `( x

  W( d+ }# Z% X8 z
qemu-img check debian.qcow2
: H/ A. A/ b; s" `& R6 c8 Z  bNo errors were found on the image.
! d7 b# [5 e6 d/ j74133/81920 = 90.49% allocated, 0.00% fragmented, 0.00% compressed clusters
+ C2 s5 t7 X! p% U9 w& q' L0 EImage end offset: 4859428864
4 ?3 p! ?% f) u1 o2 k
[root@controller src]# qemu-img convert -c  -O qcow2 debian.qcow2 debian.qcow2.qcow2" R! A  S# w) I* H" K
/ C' Z+ [/ ?' D, F( m2 _. L

' l( L9 m) k; U( J/ L& [
" `6 i+ i( x* }. }' S% z3 ]" W& D

) I' V! F( _& e6 T/ W% _

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-6-28 15:10:24 | 显示全部楼层
[root@controller src]# qemu-img check debian.qcow2.qcow2
' E' Y' N: t9 _: X9 L% Q' wNo errors were found on the image.
( t; x* s% Y, t8 ]$ K) d; n74133/81920 = 90.49% allocated, 35.09% fragmented, 34.67% compressed clusters
" x' O4 `$ |5 @4 K& F, Y  C, `Image end offset: 3747151872
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 03:01 , Processed in 0.015893 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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