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. scikit_learn分类器详解

    1       分类 分类是将事物按特性进行分类,例如将手写数字图片分类为对应的数字. 1.1  MINIST数字图片集分类 MINST就是一个70000张规格较小的手写数字图片,如何将他们分类为对应 ...

  2. 实验十一 MySQLl备份与恢复1

    实验十一 MySQL备份与恢复 一.  实验内容: 1. 使用SQL语句导入和导出表数据 2. 使用客户端工具备份还原数据库 3. 使用日志文件恢复数据库 二.  实验项目:学生成绩数据库 创建用于学 ...

  3. XXE验证与利用流程

    特征 特征1 --- .ashx 看到url是 .ashx后缀的 特征2 --- 响应体是xml 发现有这些特征都可以用下面的流程测试 测试 在线工具: http://ceye.io/ http:// ...

  4. 使用ElasticSearch赋能HBase二级索引 | 实践一年后总结

    前言:还记得那是2018年的一个夏天,天气特别热,我一边擦汗一边听领导大刀阔斧的讲述自己未来的改革蓝图.会议开完了,核心思想就是:我们要搞一个数据大池子,要把公司能灌的数据都灌入这个大池子,然后让别人 ...

  5. 写给程序员的机器学习入门 (二) - pytorch 与矩阵计算入门

    pytorch 简介 pytorch 是目前世界上最流行的两个机器学习框架的其中之一,与 tensoflow 并峙双雄.它提供了很多方便的功能,例如根据损失自动微分计算应该怎样调整参数,提供了一系列的 ...

  6. mysql中关于exists的深入讲解

    mysql中关于exists的讲解 我认为exists语法是mysql中一个很强大的工具,可以简单地实现某些复杂的数据处理. 下面我谈谈与exists有关的三个方面. all 与 any 首先,看到了 ...

  7. .Net微服务实践(四)[网关]:Ocelot限流熔断、缓存以及负载均衡

    目录 限流 熔断 缓存 Header转化 HTTP方法转换 负载均衡 注入/重写中间件 后台管理 最后 在上篇.Net微服务实践(三)[网关]:Ocelot配置路由和请求聚合中我们介绍了Ocelot的 ...

  8. 安装部署Tomcat服务器

                      安装部署Tomcat服务器 案例1:安装部署Tomcat服务器 案例2:使用Tomcat部署虚拟主机 案例3:使用Varnish加速Web 1案例1:安装部署Tom ...

  9. 构建LNMP

                                                                             构建LNMP 案例1:部署LNMP环境 案例2:构建L ...

  10. Python 的while循环和for循环的使用

    #循环 遍历 迭代 # while循环 a = 0while a <5: a =a+1 if a == 3: continueprint('我循环了')+str(a) # print ('我循环 ...