最終更新:2017-01-16 (月) 12:53:56 (1301d)  

VBoxManage modifyhd
Top / VBoxManage modifyhd

http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi

VBoxManage modifyhd         <uuid>|<filename>
                            [--type normal|writethrough|immutable|shareable|
                                    readonly|multiattach]
                            [--autoreset on|off]
                            [--compact]
                            [--resize <megabytes>|--resizebyte <bytes>]

リサイズ

  • VBoxManage modifyhd <ORIGINAL_VDI> --resize <size in MB>

メモ

  • resizeはexpandのみ。shrinkはできない。。

VirtualBox/仮想ディスクの圧縮

VBoxManage modifyhd <ORIGINAL_VDI> --compact
  • With the --compact option, can be used to compact disk images, i.e. remove blocks that only contains zeroes. This will shrink a dynamically allocated image again; it will reduce the physical size of the image without affecting the logical size of the virtual disk. Compaction works both for base images and for diff images created as part of a snapshot.
  • For this operation to be effective, it is required that free space in the guest system first be zeroed out using a suitable software tool. For Windows guests, you can use the SDelete tool provided by Microsoft. Execute sdelete -z in the guest to zero the free disk space before compressing the virtual disk image. For Linux, use the zerofree utility which supports ext2/ext3 filesystems. For Mac OS X guests, use the Erase Free Space? feature of the built-in Disk Utility?. Use Zero Out Data there.
  • Please note that compacting is currently only available for VDI images. A similar effect can be achieved by zeroing out free blocks and then cloning the disk to any other dynamically allocated format. You can use this workaround until compacting is also supported for disk formats other than VDI.

メモ

  • Despite the "hd" in the subcommand name, the command works with all disk images, not only hard disks.
  • For compatibility with earlier versions of VirtualBox, the "VBoxManage modifyvdi" command is also supported and mapped internally to the "modifyhd" command.

関連

参考