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等工具.后者是一个命令行解释器,可作为磁盘管理工具. 管理员可以使 ...
随机推荐
- C++ STL模板和标准模板库
一.函数模板 #include<iostream> #include<string> using namespace std; template<class T> ...
- Error while processing transaction.java.lang.IllegalStateException: begin() called when transaction is OPEN!
Spark Streaming从flume 中使用Poll拉取数据时,报如下错误: Error while processing transaction. java.lang.IllegalState ...
- 监控一姐Grafana你可认识?
我们先来认识一下格拉法纳——Grafana. 我去,这不就是实时监控大屏吗?记得 N 年前,部门为了做这么个功能,还花重金请专业公司搞过类似的图,现在想想其实也很简单呀. 话又说回来,其实 Grafa ...
- Chrome截图截满滑动栏,QQ截长屏,录屏
1.Chrome截图截满滑动栏 一般我们截图都是用QQ的Ctrl+shift+A,但是网页不好截,这里我们可以用Chrome控制台来截全网页: F12或Ctrl+shift+i打开控制台: 点击一下控 ...
- autojs,autojs 发送http请求,autojs 解析json数据
如题,我这个就直接上代码吧 (function () { let request = http.request; // 覆盖http关键函数request,其他http返回最终会调用这个函数 http ...
- find的基本查询命令《二》
Linux find命令详解 由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时间来了解一下.即使系统中含有网络文件系统( NFS),find命令在该文件系统中同样有效,只你 ...
- javaweb添加学生信息
连接数据库已经进行判断 要求: 1登录账号:要求由6到12位字母.数字.下划线组成,只有字母可以开头:(1分) 2登录密码:要求显示“• ”或“*”表示输入位数,密码要求八位以上字母.数字组成.(1分 ...
- ECSHOP数据表结构完整仔细说明教程 (http://www.ecshop119.com/ecshopjc-868.html)
s_account_log //用户账目日志表 字段 类型 Null 默认 注释 log_id mediumint(8) 否 自增ID号 user_id mediumint(8) 否 用户登录 ...
- PyJWT 详解
1.首先,我们需要先了解 JWT 的概念,所以我们先看pyjwt的官网 https://jwt.io/ 2.对于官方 JWT 有两篇博文写的不错分别如下: https://blog.csdn.net/ ...
- Array(数组)对象-->sort() 方法
1.定义和用法 sort() 方法用于对数组的元素进行排序. 默认排序顺序为按字母升序. 语法: array.sort(sortfunction) 参数: sortfunction:规定排序顺序.必须 ...