coreygoOctober 7, 2009

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:\test.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:\test.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:\test.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:\testdiff.vhd parent=c:\test.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

DiskPart.exe and managing Virtual Hard Disks (VHDs) in Windows 7的更多相关文章

  1. QEMU KVM Libvirt手册(10):Managing Virtual Machines with libvirt

    libvirt is a library that provides a common API for managing popular virtualization solutions, among ...

  2. Windows Azure Virtual Machine (32) 如何在Windows操作系统配置SFTP

    <Windows Azure Platform 系列文章目录> 下载地址:http://files.cnblogs.com/files/threestone/Windows_SFTP.pd ...

  3. [转]Uploading and Downloading VHDs to Windows Azure

    The article shows how to download and upload VHD to Azure. http://michaelwasham.com/windows-azure-po ...

  4. softlayerFastUploadVHDtoBS

    Object Storage Uploader Overview We’ve recently added the option to import customer-supplied Virtual ...

  5. PowerShell 在hyper-v中创建虚拟机

    # This script configures the Hyper-V machines used for the 50331 Course. # PowerShell 3.0 and Window ...

  6. [SQL in Azure] Getting Started with SQL Server in Azure Virtual Machines

    This topic provides guidelines on how to sign up for SQL Server on a Azure virtual machine and how t ...

  7. QEMU KVM Libvirt手册(11): Managing Storage

    When managing a VM Guest on the VM Host Server itself, it is possible to access the complete file sy ...

  8. Virtual Machine Definition File 2.2

    Virtual Machine Definition File 2.2 http://archives.opennebula.org/documentation:archives:rel2.2:tem ...

  9. 教程:使用Diskpart创建、扩展或删除磁盘分区

    在Windows Server环境下进行基本的磁盘操作时,管理员可以使用Disk Partition Utility或Diskpart等工具.后者是一个命令行解释器,可作为磁盘管理工具. 管理员可以使 ...

随机推荐

  1. Java数据结构与排序

    一.引子:想要给ArrayList排序却发现没有排序方法?你有两种选择:        1.换用TreeSet:     2.使用Collection.sort(List<T> list) ...

  2. 解决ASP.NET MVC返回的JsonResult 中 日期类型数据格式问题,和返回的属性名称转为“驼峰命名法”和循环引用问题

    DateTime类型数据格式问题 问题 在使用ASP.NET MVC 在写项目的时候发现,返回给前端的JSON数据,日期类型是 Date(121454578784541) 的格式,需要前端来转换一下才 ...

  3. IO 流

    ------------恢复内容开始------------ 一.流的简介 输入流:把硬盘中的数据读取到内存中 输出流:把内存中的数据读取到硬盘中 1字符=2字节 1字节=8位 1.2顶级父类  二. ...

  4. 面试常问的 Java 虚拟机运行时数据区

    写在前面 本文描述的有关于 JVM 的运行时数据区是基于 HotSpot 虚拟机. 概述 JVM 在执行 Java 程序的过程中会把它所管理的内存划分为若干个不同的数据区域.这些区域都有各自的用途,以 ...

  5. 1000行MySQL学习笔记,不怕你不会,就怕你不学!

    Windows服务 -- 启动MySQL net start mysql-- 创建Windows服务 sc create mysql binPath= mysqld_bin_path(注意:等号与值之

  6. Light of future-凡事预则立

    目录 1.冲刺的时间计划安排 2.针对上一次作业同学.助教提出的问题的回答 3.针对前几次作业的不足的地方进行思考和总结 4.需要改进的团队分工 5.团队的代码规范 6.Github仓库链接 归属班级 ...

  7. JAVA中的==和queals()的区别

    一.先来说说Java的基本数据类型和引用类型 八大基本数据类型:Byte,short,int,long,double,folat,boolean,char,其中占一个字节的是byte,short和ch ...

  8. matplotlib BlendedGenericTransform(混合变换)和CompositeGenericTransform(复合变换)

    2020-04-10 23:31:13 -- Edit by yangrayBlendedGenericTransform是Transform的子类,支持在x / y方向上使用不同的变换.(博主翻译为 ...

  9. Python设计模式(7)-建造者模式

    # coding=utf-8 class Report: def create_head(self): pass def create_body(self): pass class year_Repo ...

  10. Spring Cloud 系列之 Consul 注册中心(一)

    Netflix Eureka 2.X https://github.com/Netflix/eureka/wiki 官方宣告停止开发,但其实对国内的用户影响甚小,一方面国内大都使用的是 Eureka ...