如何在Linux 5上使用dd命令获取磁盘映像,然后在Virtual中最终使用它?
发布于 2016-05-24 09:53:07
我还没有亲自测试过这一点,但这是我理解它是可能的。
启动到服务器并安装足够大的外部硬盘驱动器,您可以在其中存储映像。映像服务器的硬盘驱动器:
dd if=/dev/sdX bs=4k conv=noerror,sync of=/mount_point_of_extHDD/serverIMG.dd然后,让我们将未使用的块清零:
file /path/to/serverIMG.dd检查文件命令输出中的start扇区值,将其乘以512。这就是你的“抵消”价值。挂载图像:
mount -o loop,rw,offset=<counted_value_here> -t <partitions_filesystem_type> /path/to/serverIMG.dd /mnt/tmp
cat /dev/zero > zeroes.file
rm zeroes.file然后卸载图像。启动到安装了virtualbox的机器,这样就可以将原始映像修改为vhd:
VBoxManage convertfromraw serverIMG.dd serverIMG.vhd --format VHDhttps://unix.stackexchange.com/questions/285083
复制相似问题