hashicorp/vagrant · error

VirtualBox does not support shrinking disk sizes. Cannot shr

Error message

VirtualBox does not support shrinking disk sizes. Cannot shrink '%{name}' disks size.

What it means

Error "VirtualBox does not support shrinking disk sizes. Cannot shrink '%{name}' disks size." thrown in hashicorp/vagrant.

Source

Thrown at plugins/providers/virtualbox/cap/configure_disks.rb:230

            dvd_metadata[:device] = dsk_info[:device]
            dvd_metadata[:uuid] = attachment[:uuid]
            dvd_metadata[:controller] = controller.name
          end

          dvd_metadata
        end

        # Check to see if current disk is configured based on defined_disks
        #
        # @param [Kernel_V2::VagrantConfigDisk] disk_config
        # @param [Hash] defined_disk
        # @return [Boolean]
        def self.compare_disk_size(machine, disk_config, defined_disk)
          requested_disk_size = Vagrant::Util::Numeric.bytes_to_megabytes(disk_config.size)
          defined_disk_size = defined_disk[:capacity].split(" ").first.to_f

          if defined_disk_size > requested_disk_size
            machine.ui.warn(I18n.t("vagrant.cap.configure_disks.shrink_size_not_supported", name: disk_config.name))
            return false
          elsif defined_disk_size < requested_disk_size
            return true
          else
            return false
          end
        end

        # Creates and attaches a disk to a machine
        #
        # @param [Vagrant::Machine] machine
        # @param [Kernel_V2::VagrantConfigDisk] disk_config
        # @param [VagrantPlugins::ProviderVirtualBox::Model::StorageController] controller -
        # the storage controller to use
        def self.create_disk(machine, disk_config, controller)
          machine.ui.detail(I18n.t("vagrant.cap.configure_disks.create_disk", name: disk_config.name))
          # NOTE: At the moment, there are no provider specific configs for VirtualBox
          # but we grab it anyway for future use.

View on GitHub (pinned to 35f3160f4a)

When it happens

Trigger: Thrown at plugins/providers/virtualbox/cap/configure_disks.rb:230 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/2b89ba7bd696c3cb. Report an issue: GitHub.