Sup*_*ric 50 virtualbox clone dd vdi
我想从我的硬盘驱动器中制作一个 VirtualBox .vdi 图像。
我在网上找到了如何通过首先使用 DD 创建 .raw 图像,然后使用 VBoxManage 将 .raw 转换为 .vdi 来描述这样做的方法。所以如果我的 HD 是 1 TB,这个过程(临时)需要 2TB 的空间来存储 .raw 和 .vdi。
我只有 1TB 以上的可用空间。有没有办法创建硬盘驱动器的 .vdi 映像,而不必先创建 .raw 映像?
小智 66
您可以直接使用VBoxManage convertfromraw
. 首先卸载设备,然后:
VBoxManage convertfromraw /dev/sda MyImage.vdi --format VDI
Run Code Online (Sandbox Code Playgroud)
替换/dev/sda
为您要克隆的任何磁盘或分区。
您可能需要以 root 身份执行此操作才能访问设备。如果是这样,那么您应该更改完成图像的所有权。
小智 9
我尝试了接受的解决方案,但对我来说它失败了:
# VBoxManage convertfromraw /dev/sdg /path/to/file.vdi --format VDI
Converting from raw image file="/dev/sdg" to file="/path/to/file.vdi"...
Creating dynamic image with size 0 bytes (0MB)...
VBoxManage: error: Cannot create the disk image "/path/to/file.vdi": VERR_INVALID_PARAMETER
Run Code Online (Sandbox Code Playgroud)
也许它无法检测到大小,因为磁盘是通过 USB 连接的?
所以相反我得到了磁盘的大小 fdisk -l
Disk /dev/sdg: 160.0 GB, 160041885696 bytes
Run Code Online (Sandbox Code Playgroud)
然后我使用了convertfromraw的stdin形式
# dd if=/dev/sdg | VBoxManage convertfromraw stdin /path/to/file.vdi 160041885696 --format VDI
Converting from raw image file="stdin" to file="/path/to/file.vdi"...
Creating dynamic image with size 160041885696 bytes (152628MB)...
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
126220 次 |
最近记录: |