°Ô½Ã¹° 1,369°Ç
   
qemu-nbd and zerofill
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2015-10-14 (¼ö) 14:11 Á¶È¸ : 5773
±ÛÁÖ¼Ò :
                                
µ¿ÀûÀ¸·Î È®ÀåµÈ À̹ÌÁö Å©±â º¯È¯ (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

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.