DiskPart.exe and managing Virtual Hard Disks (VHDs) in Windows 7
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.
- 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
- 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 - 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
- Virtual Hard Disk Getting Started Guide: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=d2afacbb-5af6-45c2-b275-932116e27b0b
- DiskPart.exe command line help
DiskPart.exe and managing Virtual Hard Disks (VHDs) in Windows 7的更多相关文章
- QEMU KVM Libvirt手册(10):Managing Virtual Machines with libvirt
libvirt is a library that provides a common API for managing popular virtualization solutions, among ...
- Windows Azure Virtual Machine (32) 如何在Windows操作系统配置SFTP
<Windows Azure Platform 系列文章目录> 下载地址:http://files.cnblogs.com/files/threestone/Windows_SFTP.pd ...
- [转]Uploading and Downloading VHDs to Windows Azure
The article shows how to download and upload VHD to Azure. http://michaelwasham.com/windows-azure-po ...
- softlayerFastUploadVHDtoBS
Object Storage Uploader Overview We’ve recently added the option to import customer-supplied Virtual ...
- PowerShell 在hyper-v中创建虚拟机
# This script configures the Hyper-V machines used for the 50331 Course. # PowerShell 3.0 and Window ...
- [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 ...
- 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 ...
- Virtual Machine Definition File 2.2
Virtual Machine Definition File 2.2 http://archives.opennebula.org/documentation:archives:rel2.2:tem ...
- 教程:使用Diskpart创建、扩展或删除磁盘分区
在Windows Server环境下进行基本的磁盘操作时,管理员可以使用Disk Partition Utility或Diskpart等工具.后者是一个命令行解释器,可作为磁盘管理工具. 管理员可以使 ...
随机推荐
- Java读源码之ReentrantLock
前言 ReentrantLock 可重入锁,应该是除了 synchronized 关键字外用的最多的线程同步手段了,虽然JVM维护者疯狂优化 synchronized 使其已经拥有了很好的性能.但 R ...
- (3)SQL Server表分区
1.简介 当一个表数据量很大时候,很自然我们就会想到将表拆分成很多小表,在执行查询时候就到各个小表去查,最后汇总数据集返回给调用者加快查询速度.比如电商平台订单表,库存表,由于长年累月读写较多,积累数 ...
- 1-1. OSS/ALSA 声卡的驱动与配置和 Madplay 嵌入式播放器的移植
报警子系统 一. OSS/ALSA 声卡的驱动与配置 声卡驱动中传统的OSS构架在02年被收购后即不开源,并且OSS的混音效果不好->因此ALSA构架孕育而生. ALSA(高级音频构架,目前应用 ...
- WinForm中DataGridView复制选中单元格内容解决方案
WinForm中DataGridView鼠标选中单元格内容复制方案 1.CTR+C快捷键复制 前提:该控件ClipboardCopyMode属性设置值非Disable: 2.鼠标框选,自定义代码实现复 ...
- Ring 笔记 - 核心概念
Ring 是一个在 Clojure 中的对于 HTTP 的抽象,是构建 Web 应用的底层接口和库,类似于 Java 中的 Servlet 核心概念 Handler Handler 是一个定义web应 ...
- mysql正则匹配中文时存在的问题
可以看到,目前正则匹配字母没问题,c出现1次,2次,3次匹配的结果都是正常的 接下来我们看看匹配中文的效果 可以看到,当匹配连续出现歪时,结果就开始不正常了 然后我去看了下mysql的中文文档中关于正 ...
- Linux网络架设篇,虚拟机l系统中网卡设备名与配置文件不符如何处理?
很多情况下,当我们在虚拟机中安装好linux系统后,并不能成功连上网.当我们配置好相关IP地址后同样不能成功连接网络.并且会体会网卡名与配置名不符,这时候应该怎么办呢? 1.清空下面文件 /etc/u ...
- 29.2 Iterator 迭代器
/* * 集合的遍历方式: * 1.toArray(),可以把集合转换成数组,然后遍历数组即可 * 2.iterator(),可以返回一个迭代器对象,我们可以通过迭代器对象来迭代集合 * * Iter ...
- Python Requests-学习笔记(8)-重定向与请求历史
重定向与请求历史 默认情况下,除了 HEAD, Requests会自动处理所有重定向. 可以使用响应对象的 history 方法来追踪重定向. Response.history 是一个:class:R ...
- Vue 核心最基本的功能
~~~<html><head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"& ...