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等工具.后者是一个命令行解释器,可作为磁盘管理工具. 管理员可以使 ...
随机推荐
- Python——matplotlib基础绘图函数示例
1. 2.饼图 (1) import matplotlib.pyplot as plt labels='frogs','hogs','dogs','logs'% sizes=[15,30,45,10] ...
- Java是未来的第一编程语言吗?
目录 一.前言 二.Java帝国的今天 2.1 依然霸占TIOBE热门编程语言的榜首 2.2 曾经想扼杀Java的微软宣布加入OpenJDK 2.3 Oracle发布开源全栈虚拟机GraalVM 三. ...
- Python数据库MySQL之数据备份、pymysql模块
一 IDE工具介绍 生产环境还是推荐使用mysql命令行,但为了方便我们测试,可以使用IDE工具 下载链接:https://pan.baidu.com/s/1bpo5mqj 掌握: #1. 测试+链接 ...
- Python第十三章-网络编程
网络编程 一.网络编程基础 python 的网络编程模块主要支持两种Internet协议: TCP 和 UDP. 1.1通信协议 通信协议也叫网络传输协议或简称为传送协议(Communications ...
- canvas 悬浮效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 泛型代码中的 default 关键字
在泛型类和泛型方法中会出现的一个问题是,如何把缺省值赋给参数化类型,此时无法预先知道以下两点: l T将是值类型还是引用类型 l 如果T是值类型,那么T将是数值还是结构 对 ...
- 1018 Public Bike Management (30 分)
There is a public bike service in Hangzhou City which provides great convenience to the tourists fro ...
- python CGI 编程实践
文章更新于:2020-03-05 注1:安装 python 参见: python 的安装使用和基本语法 注2:配置 web 环境参见: Windows&linux使用集成环境搭建 web 服务 ...
- python 写一个生成大乐透号码的程序
""" 写一个生成大乐透号码的程序 生成随机号码:大乐透分前区号码和后区号码, 前区号码是从01-35中无重复地取5个号码, 后区号码是从01-12中无重复地取2个号码, ...
- NumPy学习2:创建数组
1.使用array创建数组 b = array([2, 3, 4])print bprint b.dtype 2.把序列转化为数组 b = array( [ (1.5,2,3), (4,5,6) ] ...