none
How to Safely Remove Hardware under Hyper-V 2008 R2?

    Question

  • Hi,

    I'm using Hyper-V Server 2008 R2, but it seems that there is broader experience/support with Server Core, so I'll try this question here.

    There's no GUI, so how do I Safely Remove Hardware, e.g. a USB-attached external backup drive? I'm looking for a command-line tool to list removable drives, let me specify what to remove, and tell me when it's safe to remove it.

    Also, how do I configure the drive properties (either safe removal or turn on write caching)?

    Thanks,

    Mark Berry
    MCB Systems
    Sunday, December 06, 2009 1:54 AM

Answers

  • Hi,

    Unfortunately there are no inbox command line tools that allow you to stop USB devices. Two options are to logoff, which will flush the cache and make it safe to remove, or to use devcon.exe (search on microsoft.com and support.microsoft.com for more details).

    Andrew
    Wednesday, December 23, 2009 4:31 PM
    Owner

All replies

  • Hi,

     

    You can refer to:

     

    PowerShell  Scripting - trying to eject a usb device

    http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Q_22850824.html

     

    Important Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

     

     

    Best Regards,

    Vincent Hu

     

    Tuesday, December 08, 2009 8:42 AM
    Moderator
  • Vincent,

    Thank you for your reply.

    That article gives instructions on how to call deveject.exe from PowerShell. Deveject.exe is available from ftp://ftp.heise.de/pub/ct/listings/0316-208.zip.

    I am hesitant to run .exe software downloaded from an unofficial site.

    Are you saying that there is no supported way to safely remove hardware from a Server Core or Hyper-V Server installation?

    Mark Berry
    MCB Systems
    Tuesday, December 08, 2009 5:01 PM
  • Hi,

    Unfortunately there are no inbox command line tools that allow you to stop USB devices. Two options are to logoff, which will flush the cache and make it safe to remove, or to use devcon.exe (search on microsoft.com and support.microsoft.com for more details).

    Andrew
    Wednesday, December 23, 2009 4:31 PM
    Owner
  • Andrew,

    Thanks for your comment.

    I don't see how logging off makes it safe to remove? A server can (and usually does) access drives when no one is logged on.

    If I recall correctly, Devcon is not available in a 64-bit version online.

    I am pursuing this in a partner forum. The best advice there so far is to use fsutil volume dismount before removal.

    Mark Berry
    MCB Systems
    Tuesday, January 12, 2010 6:59 AM
  • Old question, but maybe this could help if you plan to disconnect a USB storage (using only Hyper-V without installing any additional software):

    1) On command prompt, type "diskpart" and wait for the new prompt, then type "list volume". Take note of the number of your desired volume by watching its drive letter (be carefull!!!)

    2) Type "select volume <number>", where <number> is the number of your USB storage.

    3) Then, type "remove all dismount". Type "exit" to leave diskpart. Enjoy! ;)

    According to the diskpart remove´s help (type "help remove" inside diskpart):

    ==================

    " DISMOUNT    This parameter may be used if 1) all drive letters and
                 mounted folder paths have been removed from the volume, or
                 2) the ALL parameter is specified.  This parameter
                 specifies that the file system is to be dismounted and
                 the volume taken offline. If other processes are using
                 the volume, DiskPart closes any open handles before
                 dismounting the file system and taking the volume offline.
                 You can bring the volume online by assigning it a driver
                 letter, by creating a mounted folder path to the volume, or
                 by using the ONLINE command. DISMOUNT will fail if used
                 on a volume that has any remaining drive letters or mounted
                 folder paths. For scripting, using REMOVE ALL DISMOUNT is
                 recommended."

    ===============

    Now you can safely remove your USB storage device from the Hyper-V server.

    Regards,

    Du

    Tuesday, January 04, 2011 12:36 PM
  • Old question, but maybe this could help if you plan to disconnect a USB storage (using only Hyper-V without installing any additional software):

    1) On command prompt, type "diskpart" and wait for the new prompt, then type "list volume". Take note of the number of your desired volume by watching its drive letter (be carefull!!!)

    2) Type "select volume <number>", where <number> is the number of your USB storage.

    3) Then, type "remove all dismount". Type "exit" to leave diskpart. Enjoy! ;)

    According to the diskpart remove´s help (type "help remove" inside diskpart):

    ==================

    " DISMOUNT    This parameter may be used if 1) all drive letters and
                 mounted folder paths have been removed from the volume, or
                 2) the ALL parameter is specified.  This parameter
                 specifies that the file system is to be dismounted and
                 the volume taken offline. If other processes are using
                 the volume, DiskPart closes any open handles before
                 dismounting the file system and taking the volume offline.
                 You can bring the volume online by assigning it a driver
                 letter, by creating a mounted folder path to the volume, or
                 by using the ONLINE command. DISMOUNT will fail if used
                 on a volume that has any remaining drive letters or mounted
                 folder paths. For scripting, using REMOVE ALL DISMOUNT is
                 recommended."

    ===============

    Now you can safely remove your USB storage device from the Hyper-V server.

    Regards,

    Du


    Thanks, works like a charm!
    Thursday, January 15, 2015 10:43 AM