# VBoxManage modifymedium

VBoxManage-modifymedium

1

VBoxManage-modifymedium

change the characteristics of an existing disk image

&product-name;

          VBoxManage modifymedium

            disk
            dvd
            floppy

            uuid
            filename

          --autoreset=on | off
          --compact
          --description=description
          --move=pathname
          --property=name=[value]
          --resize=megabytes | --resizebyte=bytes
          --setlocation=pathname
          --type=normal | writethrough | immutable | shareable | readonly | multiattach

## Description

The `VBoxManage modifymedium` command enables you to change the characteristics of an existing disk image.

For compatibility with earlier versions of &product-name;, you can use the `modifyvdi` and `modifyhd` commands.

disk | dvd | floppy

- Specifies the media type of the image.

`filename`

- Specifies the Universally Unique Identifier (UUID) or path name of the disk image on the host file system. You can specify the UUID only if the medium is registered. Use the `VBoxManage list hdds` command to list the registered images. You can specify an absolute or relative path to the medium.

`--autoreset=on | off`

- Specifies whether to automatically reset an immutable hard disk on every virtual machine (VM) startup. This option is only for immutable hard disks and the default value is `on`. See hdimagewrites.

`--compact`

- Compresses disk images by removing blocks that contain only zeroes. This option shrinks a dynamically allocated image and reduces the physical size of the image without affecting the logical size of the virtual disk.

  You can use this option for base images and for differencing images that are created as part of a snapshot.

  Before you compress the image, you must use a suitable software tool to zero out free space in the guest system. For example:

  - Windows guests. Run the `sdelete -z` command.

  - Linux guests. Use the `zerofree` utility, which supports `ext2` and `ext3` file systems.

  - Mac OS X guests. Use the `diskutil secureErase freespace 0 /` command.

  Note that you can only use this option to compress VDI images. To compress non-VID images, you can zero out free blocks and then clone the disk to any other dynamically allocated format.

`--description=`description``

- Specifies a text description of the medium.

`--move=`pathname``

- Specifies a relative or absolute path to a medium on the host system. Use this option to relocate a medium to a different location on the host system.

`--property=`name`=`value``

- Specifies a property name and value for the medium.

`--resize=`size``

- Specifies the new capacity of an existing image in MB. You can use this option only to expand the capacity of an image. You can cannot shrink the capacity of an image.

  Note that you can only resize dynamically allocated disk images that use the VDI and VHD formats. This option adjusts the logical size of a virtual disk and has only a minor affect on the physical size.

  For example, if your dynamically allocated 10 GB disk is full, you can use the `--resize 15360` option to increase the capacity of the existing disk to 15 GB (15,360 MB). This operation enables you to avoid having to create a new image and copy all data from within a VM.

  Note that using this option only changes the capacity of the drive. So, you might need to subsequently use a partition management tool in the guest to adjust the main partition to fill the drive.

`--resizebyte=`size``

- Specifies the new capacity of an existing image in bytes. This option is similar to the `--resize` option, but you specify the size in bytes instead of megabytes.

`--setlocation=`pathname``

- Specifies the new location of the medium on the host system after the medium has been moved. The path name can be relative to the current directory or be absolute to the root.

  Note that the `VBoxManage modifymedium` command does not perform any sanity checks on the path name you specify. Ensure that the path name is valid.

`--type`

- Specifies the new mode type of an existing image. Valid values are `normal`, `immutable`, `writethrough`, `multiattach`, `shareable`, and `readonly`. For descriptions of these mode types, see hdimagewrites.

## Examples

The following command modifies the description for the disk image file called `disk01.vdi`.

    $ VBoxManage modifymedium disk disk01.vdi --description "Oracle Linux 7 image"

The following command modifies the write mode for the disk image file called `disk01.vdi`.

    $ VBoxManage modifymedium disk disk01.vdi --type writethrough

## See Also

vboxmanage-list