type
status
date
slug
summary
tags
category
icon
password
Property
Feb 9, 2023 01:01 PM
Document:
The virtual hard disk v2 (VHDX) file format provides features at the virtual hard disk as well as virtual hard disk file layers and is optimized to work well with modern storage hardware configurations and capabilities.
Create
使用diskpart创建:
需要先输入diskpart进入其context, 再执行下面命令(下同)
常用参数
file (required)指定vhdx文件路径, 注意需要full path, eg:
C:\windows.vhdxmaximum (required)The maximum amount of space that is exposed by the VHD file in megabytes (MB).
type=fixed|expandable- Fixed (default): Creates a fixed VHD, which has an allocated size that does not change. For example, if you create a fixed VHD that is 24 gigabytes (GB), the file will be approximately 24 GB (with some space used for the internal VHD structure) regardless of the data that is written to it. Creating a fixed VHD takes longer than creating an expandable VHD because the entire file is allocated at the time it is created.
- Expandable: Creates a dynamically expanding VHD, which expands to accommodate the data that it contains. For example, a 24 GB dynamically expanding VHD is initially around 80 megabytes (MB) on the host file system. As data is written to the VHD, the file grows, but it has a maximum size of 24 GB.
parent指定parent vhdx路径, 用于创建differencing VHD file
The differencing VHD contains only the changes from the parent VHD. The parent can be any type of VHD (fixed, dynamically expanding, or differencing). The parent VHD is read-only, so you must modify the differencing VHD.
When you use this parameter to create a differencing VHD, you cannot specify the type parameter. This is because the differencing VHD file always uses the type from the parent VHD.
sourceSpecifies to create a new VHD file that is a copy of the source file at <file path>. Note that there is no parent-child relationship established between the new VHD and the source VHD.
Mount&Unmount
Attaches (sometimes called mounts or surfaces) a virtual hard disk (VHD) so that it appears on the host computer as a local hard disk drive.
Note: 这里挂载的是虚拟硬盘. 上面还不包含分区信息, 也没有文件系统和盘符
attach之后,可以用如下命令(还是都在diskpart context下):
- 选择vdisk硬盘(如果上面选择过就不用了)
- 转换为GPT partition style
- 创建分区
- 格式化
tips: 参数可以用文档的\Foo:Bar格式, 也可以foo=bar
- 指定盘符
![[MS-VHDX]: Overview](https://www.notion.so/image/https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmedia%2Flogos%2Flogo-ms-social.png?table=block&id=41a6bf62-70af-467f-ae9e-024ffd4a4fb6&t=41a6bf62-70af-467f-ae9e-024ffd4a4fb6)


