Home > Storage, VMware, vSphere > Hot Remove a hard disk from a Virtual Machine on vSphere 4.1

Hot Remove a hard disk from a Virtual Machine on vSphere 4.1

Hot Adding hard disks has been around since the stone ages on VMware platforms.  As from vSphere 4.1, you can also Hot Remove a hard disk (VMDK and RDMs!) from a Virtual Machines.  This means that there is no downtime for the Virtual Machine and no reboot is necessary!

In my opinion this is a huge improvement and quite a benefit.

You have to be carefull however to remove/disable/uninstall/whatever the hard disk inside the VM first to make sure that the VM is not affected.

The remove operation is not a big deal for vSphere, but if your VM is still accessing that disk, things might get ugly inside the VMโ€ฆ  (just think of a physical Windows box and disappearing SAN connection ๐Ÿ™‚ ).

Letโ€™s see how to Hot Remove a hard disk for a Windows Server 2008 R2.  This method works from Windows 2000 and higher but the screenshots might differ.

Our VM has a hard disk of 5 GB we no longer useโ€ฆ

image

All data is deleted from it and we want to get rid of it.

First, fire up Server Manager and go Storage โ€“ Disk Management.

image

Our Disk will be shown.

image

Right-Click the Partition (RemoveMe in this example) and select Delete Volume.

image

Click Yes to delete the partition.

image

Right-Click the Disk 1 entry and select Properties.

image

Open the Driver tab and click the Uninstall button.

image

Click OK to Uninstall the device.

image

Open the Edit Settings screen of the VM.  Select the Hard Disk and click Remove.

image

Select Remove from virtual machine and delete files from disk.

image

Thatโ€™s it!  You disk is removed without downtime!

Advertisements
Categories: Storage, VMware, vSphere
  1. T2K
    March 7, 2011 at 20:00

    all good if there are no open files (pagefile) on the disk ๐Ÿ˜‰

    • March 7, 2011 at 20:57

      Agreed ๐Ÿ™‚

    • Umesh
      February 26, 2013 at 15:50

      What happens if the disk having page file is removed in windows 2008 R2?

      • April 14, 2013 at 19:54

        Don’t thinks that’s really healthy ๐Ÿ™‚

        You need a page file anyway for Windows to dump a kernel dump when it crashes…

  2. Suresh
    October 4, 2011 at 10:44

    This script just pulls off the Hard disk while the VM is powered on. Brute-force method ๐Ÿ˜€

    $vmName = “MyVM”
    $hdName = “Hard disk 3”

    $vm = Get-VM $vmName | Get-View
    $tgtdev = $vm.Config.Hardware.Device | where {$_.DeviceInfo.Label -eq $hdName}
    $dev = New-Object VMware.Vim.VirtualDeviceConfigSpec
    $dev.operation = “remove”
    $dev.device = $tgtdev
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.DeviceChange += $dev
    $vm.ReconfigVM($spec)

  3. vpert
    April 26, 2012 at 07:25

    Does this also remove the disk from the VM configuration?

    • May 2, 2012 at 08:43

      You do this ‘manually’ in the last two screenshots. This will remove the vmdk file from the datastore and detach it from the VM.

      • vpert
        May 2, 2012 at 11:24

        Thx for your reply – so it’s different from the remove of a network adapter, which it also removes from the VM configuration.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: