在Windows里用VBoxManage将动态扩展硬盘的vhd转成固定大小的
问题:从镜像站下载的FreeBSD虚拟硬盘文件vhd是动态扩展的,虽然可以在VitualBox里使用,但无法在Linux系统里使用dd命令还原。
尝试:
1.下载FreeBSD的镜像文件,如国内的可从阿里云镜像点下载 https://mirrors.aliyun.com/freebsd/releases/VM-IMAGES/12.0-RELEASE/amd64/Latest/FreeBSD-12.0-RELEASE-amd64.vhd.xz
2.下载到本地后,用7-zip解压,得到 FreeBSD-12.0-RELEASE-amd64.vhd 文件
3.使用VBoxManage.exe程序,将vhd磁盘文件从动态扩展的转成固定大小的类型,如 VBoxManage.exe clonemedium disk "I:\vhd\FreeBSD-12.0-RELEASE-amd64.vhd3\FreeBSD-12.0-RELEASE-amd64.vhd" "I:\vhd\FreeBSD-12.0-RELEASE-amd64.vhd3\FreeBSD-12.0-RELEASE-amd64-b.vhd" –variant Fixed
4.如提示原vhd磁盘的uuid重复,可先生成新的uuid,如 VBoxManage.exe internalcommands sethduuid "I:\vhd\FreeBSD-12.0-RELEASE-amd64.vhd3\FreeBSD-12.0-RELEASE-amd64.vhd"
5.通过dd命令,成功将固定大小类型的vhd文件复制到指定的硬盘上
参考: