µ¿ÀûÀ¸·Î È®ÀåµÈ À̹ÌÁö Å©±â º¯È¯ (zero-fill)
:: HOST ³»¿¡¼ ÀνÄÁßÀÎ µð½ºÅ© Å©±âÈ®ÀÎ (µ¿ÀûÀ¸·Î È®ÀåµÈ À̹ÌÁö)
# qemu-img info disk
image: disk
file format: qcow2
virtual size: 160G (171798691840 bytes)
disk size: 7.2G
cluster_size: 65536
backing file: /var/lib/nova/instances/_base/xxxxxe63f446daf1f5522
Format specific information:
compat: 1.1
lazy refcounts: false
corrupt: false
:: À̹ÌÁö ¸¶¿îÆ®
# qemu-nbd -c /dev/nbd0 disk
# kpartx -a /dev/nbd0
# mount /dev/mapper/nbd0p1 /mnt
:: ½ÇÁ¦ »ç¿ëÁßÀÎ µð½ºÅ© Å©±â (VM¿¡¼ ÀνĵǴÂ)
# df -Th |grep mnt
/dev/mapper/nbd0p1 ext4 7.8G 766M 6.6G 11% /mnt
# dd if=/dev/zero of=/mnt/file.zeros
dd: `/mnt/file.zeros' ·Î ¾²´Â Áß: ÀåÄ¡¿¡ ³²Àº °ø°£ÀÌ ¾øÀ½
14606969+0 ·¹ÄÚµå µé¾î¿È
14606968+0 ·¹ÄÚµå ³ª°¨
7478767616 ¹ÙÀÌÆ® (7.5 GB) º¹»çµÊ, 550.691 ÃÊ, 13.6 MB/ÃÊ
:: »èÁ¦ & umount
# rm -rf /mnt/file.zeros
# umount /mnt
# kpartx -d /dev/nbd0
# qemu-nbd -d /dev/nbd0
/dev/nbd0 disconnected
:: À̹ÌÁö convert
# qemu-img convert disk -O qcow2 disk_resize.qcow2
# qemu-img info disk_resize.qcow2
image: disk_resize.qcow2
file format: qcow2
virtual size: 160G (171798691840 bytes)
disk size: 832M
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
corrupt: false