Remove hard disk while the VM is on

I have a requirement for the removal of a hard disk of a VM to script while it is running. I can do this OK the client virtual infrastructure, but if I try and get the PowerCLI I get an error that the operation cannot be performed while the virtual machine is on. Any ideas on how to work around this problem? Here are the commands I'm using:

$hd = get-disk hard - vm myvmname | where {$_.} Name - eq 'hard drive'}

Remove-hard drive - disk hard $hd - confirm: $false

I am running 4.0U1 PowerCLI and the latest version of vSphere, ESXi and vCenter.

Thank you

James

You can remove hard drives a guest under tension when the disks are connected to a SCSI controller.

For IDE hard drives that won't work.

And you are right, that the cmdlet Remove-hard drive does not seem to be taken into account.

It will remove only the hard drives when the host is turned off.

But you can use the SDK ReconfigVM_Task 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)

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • How can I "RECORD each piece of data (and I mean everything!)" contained in the hard disk of the laptop? »

    How can I "RECORD each piece of data (and I mean everything!)" contained in the hard disk of the laptop? »

    I know PC never fade completely everything, so if there is a way to get personally, I'd really like the head upward on the how to do?  I would be better for me to download all this information on a PHDD, rather than handing the portable real in question so that its content of forensics experts, because current 'Communications Network serious security' we have been subjected to.

    Here you go:

    1. Use an imaging program to create a clone of your hard drive.
    2. Delete the original from your PC hard drive and keep it somewhere safe.
    3. Put the clone in the PC.
    It is the only way to really keep all while still able to use the PC.
  • Re: Satellite Pro A40 - can I change the HARD disk or the same model?

    Hi Forum,

    do I have to wait for safe trouble by changing the hard disk between the following laptops:

    old or damaged laptop:
    SPA40 model PSA45E - 0013T - number GR
    Series No. 34127882 H

    new/own laptop
    SPA40 PSA45E-001VM-GR model number
    Series N0.34117607H

    Thanks in advance for your advice

    Concerning

    You can do it. No problem at all. Hard drives are not specific model of laptop parts and with hard drives is important compatibility.
    On the new laptop, which you can use different hard drives. Important is that use you compatible HARD drive.

    Just do it. After Exchange of HARD drive install Os again and everything will be OK.

  • How to check the type of hard disk of the windows operating system?

    on linux, we can find the hdd for example of name setail

    Type a - ide

    SDA - ACHI or sata or sas

    a way to find the type of hard disk in the windows operating system? as linux

    any command or something

    In Windows 7, you can get a lot of details by selecting Start, all programs, accessories, System Tools, system information, components, storage disks. It was very similar to Windows XP, but for all information users tend to use Everest or Belarc Advisor for additional information not available. Everest has been best Bellarc advice but they ceased to offer tan updated free version. However, the 2.20 version is always available from third-party sites.
    http://www.Softpedia.com/get/system/system-info/Everest-Home-Edition.shtml

  • I recently bought a computer build-yourself. My question is what is the best way to mirror or save files on the two hard disks at the same time?

    Hello community,

    I recently bought a computer build-yourself.
    My question is what is the best way to mirror or save files on the two hard disks at the same time?
    I know there is a way in diskmgmt.msc, but I can't seem to make it work.
    Spec:
    Windows 7 Professional 64 bit
    8 GB ram ddr3
    2 x 1 TB hard drive

    On Saturday, 22 September 2012 00:53:18 + 0000, kevin.coe wrote:

    As I said, I think it's not only not a good idea, I think it's a very

    a poor man. Backup should be stored outside the computer content. Or
    use a service like Carbonite Online backup.

    Ken Blake, Microsoft MVP

    What is raid? A large number of people I know use raids.

    RAID 1 (mirroring) is not a backup solution. RAID 1 uses two or
    Several readers, each one duplicate of the other, to provide redundancy,
    no backup. It is used in situations (almost always inside)
    companies, not in homes) where any city cannot be tolerated.
    because the way it works is that if a disk fails the other takes
    more seamlessly.

    Although some people thing of RAID 1 as a backup technique, it is
    what it is, because it is subject to a simultaneous loss of the
    original and many of the main dangers facing the mirror
    your data - serious power, close to the lightning seeds, virus
    attacks, stolen computer, etc. Most companies that use RAID 1
    also have a solid plan of external backup in place.

    "Why the RAID is (usually) a Terrible idea".
    http://www.pugetsystems.com/articles?&ID=29
    Ken Blake, Microsoft MVP

  • How to expand your virtual hard disk while host hard disk space is not enough?

    People,

    Hello. I use VM Player 3. My host computer is Windows 7 and VM is Oracle Linux 5. I need to expand the virtual hard drive Oracle Linux 5 from 100 GB to 150 GB. When I click on VM > Settings > hard drive > utilities > expands...

    The error message:

    There is not enough space on the file system for the selected operation.

    To after my understanding, we have enough room to store the VHD original more expanded VHD.

    This means that the free space on the host needs to be 100 GB + 150 = 250 GB

    The total size of the hard disk of the Windows 7 host is 284 GB. The VM already occupies 100 GB of 284 GB. The maximum free space is 184 GB less space and boot OS. This means that I can't develop the 100 GB to 150 GB VHD.

    But I have to expand the virtual hard disk! I don't know if there are other ways to expand the virtual hard disk.

    My question is:

    Folk understand some ways to expand the virtual hard drive ranging from 100 GB to 150 GB drive hard host is only 284 GB?

    Thanks in advance.

    You explained, it is the behavior with monolithic virtual disks, which is a unique hard file. Because the file requires more space for its metadata at the beginning of the file, all the blocks of data must be copied to a new file. With the format of sparse file 2 GB virtual disks can be extended without the need to copy the data into a new file hard, because each the hard contains its own metadata. In case you don't have at least ~ 100GB of disk space you can use vmware-vdiskmanager convert/clone the virtual drive command line utility in a format of 2 GB sparse file, delete the original virtual disk (after saving), then use vmware-vdiskmanager again to rename the new virtual disk to the old name. Once done, you will be able to expand the virtual disk as required.

    André

  • Can I switch from MX7 to CF 9 new hard disk using the MX7 serial numbers

    Hi all

    I want to install the version upgrade to coldfusion 9 on a new server / hard disk, using the serial number of MX7, that has been uninstalled.

    Is this possible?  Potential complications?

    I can't disable MX7 because this no longer exists.

    Mike

    Yes, when you enter the CF9 license, the installer will say 'it of a license upgrade, please provide the original of his licence' and give you another form to your CF7 license.  If she likes these two licenses, you're good to go.

  • Remove stranded files from the hard disk to the VM package

    I have a virtual merger machine that is now 96 GB in size (database development) and it contains several virtual hard drives.  Now, I have cleared one of the drives on and outsourced (he placed on an external Firewire based drive).  Removing the abandoned drive does not reduce the size of the virtual machine.  Research in the VM package, I see that the hard disk file (vmdk) is always inside the package and using 54 GB.

    The question is so I can delete these files from the VM package or it will damage the VM?  I tried to make a backup of the VM, but right at the end that it maintains the production of an error so I would like to know if anyone has experience with this before making the jump.

    Removing a virtual drive simply deletes the references, it does not delete the virtual disk. If you do not have a snapshot (for example), it is safe to delete. Make sure get you the right one, well - I recommend you all first move somewhere else and then try to start the virtual machine. If it is used at the moment (but maybe not if it is only used by a snapshot), merge will complain.

  • How can I remove a hard disk to the raid set default and replace it with a new one

    Last Friday apparently began one of my raid drives failing.

    As I said on this forum I started having continuous beep.

    I was finally able to get the raid works at a degraded level.  I ordered a replacement hard drive, that happened today.

    (In the meantime, I made twice daily backups of my work...)

    Below is the message that I have the raid of browser-based software:

    Blahblah 09 1000,2 GB RaidSet Member SamSung HD103SJ

    Blahblah 10 GB 1000,2 free SamSung HD103SJ

    Blahblah 11 1000,2 GB RaidSet Member SamSung HD103SJ

    Blahblah 12 GB 1000,2 RaidSet Member SamSung HD103SJ

    (See this thread sooner if you wish!)

    http://forums.Adobe.com/thread/727867?TSTART=0


    At any given time when I did the checked the browser interface, I have seen the message failed and degraded

    As I said, I was able to work this weekend on the degraded system.

    This morning I had the new tone and made the rescue and now I use a "full raid" without the advice that a raid was 'free '.

    In all cases, the new drive arrived today.

    Should what precautions I take to integrate the new drive in the raid system.

    I have an OS disk

    and raid 4 TB drives.   One needs to be replaced with the new one I get today.

    Thank you

    Rowby

    Rowby,

    You currently have your background priority set to 20% IIRC, so it will take time to rebuild, but probably a lot less than 24 hours as for new construction. Even with 20% defined, I guess that it will be done in less than 12 hours, but you can set the background priority to 50% and it will be much faster at the expense of access to your raid. Reconstruction of the background is designed to give you access to all your data files and to continue the work, while the data is being rebuilt. You can continue your work, so if it takes 8 or 12 hours to find the full data intergrity isn't all that relevant. Your aura a functional slower than with a raid reaction complete, but has more speed than a single disk.

  • Cannot remove HARD disk configuration PERC 6i with use of the SAS drives foreign. Existing data are not important. Scratch reloading to redeploy the server.

    Dell Poweredge 2950 III with serial number note from the Admin: have the label removed according to the TOU > receipt readers traded since an identical poweredge almost eliminated. In the configuration of the PERC controller 0 6i utility, disk groups show as foreigners. Messages following the procedure to import the configuration, then remove before was not effective. The prior configuration appears in the menu.

    I would like to simply clean configurations of VD for the readers and the controller. After it is deleted then next step is to set up a configuration I want. My new Setup is not relevant for this post. The goal and the only question is how to clear existing shared disk configurations.

    VD0 clear addition to figure 2 SAS PD/hard drives as virtual disk unique. RAID levels 0, status is offline, SMART status not = no error, County VD = 1, PD = 2 count, operation = none

    Is a similar to VD0 VD1

    other berries are currently empty.

    For initial troubleshooting I have removed all the HARD drive except a single disk on the server. This disc shows also as stranger.

    In the PERC 6i config utility:

    VD MGMT doesn't show CONTROLLER0 - no configuration is present. Choice of the F2 are Config. Foreign config based on availability. (Create new VD and manage preserved Cache are greyed out) Right pane of the screen indicates "foreign Config present, controller prop.: DG = 0, County VD count = 0, County of PD = 1".

    PD MGMT shows only the formatted Mo 139 K SAS single, foreign = State, SMART status not is no mistake, operation = none

    VIEW FOREIGNERS shows DG0 = foreign, Virtual disk 255 with DG count = 1. County of VD = 1, County of PD = 1

    I installed 3 of the disks individually rotating as a single HARD drive with similar results.

    WITH 2 HDD SAS installed only difference is VD Mgmt shows County DG = 0, County VD = 0, County of PD = 2.   View foreign shows VD255 prop: Raid 0, Raid = foreign status, size = na, operation = none. | Disk prop group. : VD Count = 1, County of PD = 2, Ded HS = 0 (because it does not exist).

    Thanks Chris. Problem is solved. I would like to Flash the firmware as precautionary measure? Still confused why initial in the VD Mgmt tab procedure has failed.

    All readers of Restore tab PD-ready state.

    -Dave

  • How to install the removable HARD disk in series Predator G

    I am able to remove the HARD drive bracket and see there are 4 metal poles with silent blocks.  I can't understand how to mount the HARD drive in the mount.

    Is there something Acer which shows or describes how to do this?  The plastic is flexible enough to make me able to force the sides apart, but then it can break...

    Thank you

    Lee

    If you need to remove and insert a new HARD drive hot swap Bay, you will need to enlarge the 2 plastic strips on the sides of the HARD drive.

    If you can take a photo and post, maybe I will better understand your question.

  • lost all the images contained in the "my pictures" file on the hard disk while using Windows Live Photo Gallery

    I lost all the images contained in the "my pictures" file on the hard drive.  The files are there but when I open the files they are all empty. It's like some 50 folders and each folder contained about 25 or so images jpg. I lost the using the "windows live photo gallery» I found a thread that someone else has had this problem and only one answer was to check the checkbox 'Show hidden files'. I have done this no luck there. When I open "windows live photo gallery" all records are on the left of the window but empty. I did not send any of these files to the "trash".  Can someone tell me how to recover these?

    You ran the scanner of MS too? It will take some time, but it must be done. If a virus is responsible for it must be nuked before he can ravage any more.

    Send all the pictures? You can still recover these - and get some help course in order to avoid this sort of thing. External hard drives and online storage are worth a small spending to protect valuable files. I also keep the dvd - outdated image files but enough fix if even they can deteriorate over time (but don't we all!)

    Let us know if the scan MS lands anything - run the full scan - it will take time.

    Best - R

  • Tecra 8000: Question on the HARD disk and the password

    Hi all
    A market recently my son bought an old laptop Toshiba T8000.

    Personally, I have absolutely no knowledge of the laptop myself as a desktop is everything I've ever used.
    However, I recharged the battery and the power, it asks for a password, even if what I believe to be the HD is missing (Vacant housing, left under the keyboard and behind the battery)

    Our local store offers him an incredible £121 a new HD

    HA wasted his pocket money on it or can he get a password and the HD at reasonable price to fit?

    Any help is greatly welcomed.

    BREZ.

    Hello

    Especially the password appears at the beginning of the startup procedure because the BIOS password has been set.
    Unfortunately, you cannot delete or remove the BIOS password if the old password of BIOS is not known to you. Either contact you the person who sells you the device and ask for the password or you will contact the service partner in your country for a deletion.

    I guess that's a Tecra 8000 with the number PAT80XE.
    This unit is a little older and so I think that hard drives are rare, a little so more expensive.
    By the way: the device supports an EIDE HARD disk interface

  • Reformat the hard disk of the P105-S6114

    I need to reformat the hard drive to my PC by Satellite. I inserted the disc 1, off, turned back on while pressing F12. I chose 'clear the hard disk', and this part of the process went well. It took about 1.5 hours. However, he never asked the other disk. All I get now when I turn it on is a black screen with the letter 'j' in the upper left.

    Can you tell me what to do now to re - install the default software/settings of recovery disks?

    Thank you!

    Jin

    If I understand correctly, you want to reinstall the OS with a recovery disk... In the Bios, set under the 1st boot device cd/dvdrom. Then, insert the diskette and reboot the laptop, according to the instructions on the screen that should start the installation process...
    > It took about 1.5 hours. However, he never asked the other disk. All I get now when I turn it on is a black screen with the letter 'j' in the upper left.

    To be honest, I do not know what that letter, j, means :) BU I know, the 1st recovery disk contains bones with driver and another disc with Toshiba Utilities. Perhaps, you should go to Bios and set hdd under the 1st boot device rather id cd/dvdrom

  • Missing 1.5 GB on the hard disk on the A30

    Why is my laptop missing almost two GB of hard disk space, it is really urgent, I'll buy a larger hard drive, how do I remove the disc? and how it is possible to prevent that happening in the future?
    Thanks for reading,
    Ewan

    have you ever heard of the partitions?
    This is where all the system files are stored on your hard drive, can be anywhere from 2 to 5 GB in size, an 80 GB HD will show only about 77 or 78 GB.
    This is normal on all machines

Maybe you are looking for