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等工具.后者是一个命令行解释器,可作为磁盘管理工具. 管理员可以使 ...
随机推荐
- ATM购物车+三层结构项目设计
ATM购物车项目 模拟实现一个ATM + 购物商城程序. 该程序实现普通用户的登录注册.提现充值还款等功能,并且支持到网上商城购物的功能. 账户余额足够支付商品价格时,扣款支付:余额不足时,无法支付, ...
- IDEA+EasyCode实现代码生成
IDEA+EasyCode实现代码生成 Easy Code介绍 EasyCode是基于IntelliJ IDEA开发的代码生成插件,支持自定义任意模板(Java,html,js,xml).只要是与数据 ...
- Gin框架系列03:换个姿势理解中间件
什么是中间件 中间件,英译middleware,顾名思义,放在中间的物件,那么放在谁中间呢?本来,客户端可以直接请求到服务端接口. 现在,中间件横插一脚,它能在请求到达接口之前拦截请求,做一些特殊处理 ...
- 1058 A+B in Hogwarts (20分)(水)
If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- a ...
- fastfdfs搭配nginx
fastfdfs搭配nginx 下载fastdfs-nginx-module 模块 wget https://github.com/happyfish100/fastdfs-nginx-module/ ...
- win下youtube-dl 【ERROR: requested format not available】选下载视频质量的坑--【值得一看】
需求说明(bug出处): 简单说:下载youtube的视频,嵌入翻译好的中文字幕. 详细说(可略过): 阿里的海外服务器需要布一个Web Service---用以接收国内(本地服务器)的请求, 然后用 ...
- canvas 实现光线沿不规则路径运动
canvas 实现光线沿不规则路径运动 此文章为原创,请勿转载 1.svg实现 2.canvas实现 3.坑点 svg让动画沿着不规则路径运动 查阅svg文档后发现,svg动画运动有两种实现方式,且都 ...
- 11-Json提取器使用
1.使用json提取关键信息 有时候接口返回数据为json数据或者直接为一个列表,可使用这个更简单快捷 json数据: 这样的,数据有在result里面以列表形式存在,也有在列表外的,可在json提取 ...
- windows 环境下dos 命令符下进D盘(非c盘系统盘)根目录
怎么进? 先 cd D: 然后 直接 D: 即可到D盘根目录,至于为啥要输入2遍D 才进D盘根目录,这就是windows的规定
- 2019-08-01【机器学习】有监督学习之分类 KNN,决策树,Nbayes算法实例 (人体运动状态信息评级)
样本: 使用的算法: 代码: import numpy as np import pandas as pd import datetime from sklearn.impute import Sim ...