zoukankan      html  css  js  c++  java
  • DiskPart.exe and managing Virtual Hard Disks (VHDs) in Windows 7

    In Windows 7, new commands have been added in DiskPart to allow for the creation and management of Virtual Hard Disks (.vhd files).  The DiskPart VHD management commands have been provided below in 2 sections – commonly used commands with examples and other commands.  It is assumed in each of the examples that DiskPart.exe has already been launched in an elevated command prompt.

    1. Creating a VHD
      The example below creates a 20GB dynamically expanding VHD called "test.vhd" and places it in the root of the C: drive.  Note that the type parameter is optional and the default type is fixed.

      create vdisk file=c: est.vhd maximum=20000 type=expandable
    2. Attaching a VHD
      The following example shows how to select and attach the VHD.  It also provides steps for partitioning, formatting and assigning a drive letter to the attached VHD.

      select vdisk file=c: est.vhd
      attach vdisk
      create partition primary
      format fs=ntfs label="Test VHD" quick
      assign letter=v

    3. Detaching the VHD
      To detach (i.e. unmount) the VHD, use the following example:

      select vdisk file=c: est.vhd
      detach vdisk

    Note: All 3 of these VHD actions can also be performed in the Disk Management Console of Windows 7.

    In addition, below are some other DiskPart commands that can be used to manage VHDs:

    • create vdisk file=c: estdiff.vhd parent=c: est.vhd – This will create a differencing "child" VHD (testdiff.vhd) so that the existing parent VHD (test.vhd) is not modified.  Useful when you have an image on the parent VHD that you don’t want modified.  When needing to go back to the default image, only the differencing VHD would need to be replaced.  The differencing VHD typically starts out very small – usually less than a megabyte.  As a result, it is easy to back up and replace.
    • expand vdisk maximum=<size in mb> – This expands the maximum size on a VHD.  For this to work, the virtual disk must already be selected, detached and be a non-differencing VHD.  In addition, if you do have a differencing VHD and expand the parent VHD, you will need to create a new differencing VHD.  Otherwise you will encounter a VHD corruption error when trying to select/manage the differencing VHD.
    • merge vdisk depth=1 – Merges a child VHD with its parent.  This command can be used to merge one or more differencing ("child") VHDs with its corresponding parent VHD.
    • compact vdisk – Compacts a selected VHD to reduce the physical size.  Can only be used on VHDs that are type expandable and are either detached, or attached as read only.

    Resources

  • 相关阅读:
    第四十一节 jQuery之bootstrap文档
    第四十节 jQuery之bootstrap简介
    Redis 如何实现查询附近的距离
    线上日志快速定位-grep
    Java字符串操作工具类
    JAVA批量插入数据操作+事务提交
    java开发需求中技术常见名称
    MySQL Binlog--MIXED模式下数据更新
    MySQL Replication--修改主键为NULL导致的异常
    MySQL Replication--复制异常1
  • 原文地址:https://www.cnblogs.com/liujx2019/p/11692457.html
Copyright © 2011-2022 走看看