在CentOS 7中挂载.VDI文件

在CentOS 7中挂载.VDI文件

如何在 CentOS 7 中挂载 .VDI 文件?

我正在尝试将 .vdi 硬盘驱动器从另一个 VirtualBox 实例加载到另一个 VirtualBox 实例中。我想浏览并复制 .vdi 文件中的文件。

第一次尝试时,我将 .vdi 转换为原始格式:

VBoxManage clonehd --format RAW centoOS7Python3p9_tmp-disk1.vdi centoOS7Python3p9_tmp-disk1.img

然后尝试挂载镜像:

mount -t xfs -o loop,rw ./centoOS7Python3p9_tmp-disk1.img /mnt

我收到错误:

mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

我尝试了不同的安装方式,但没有取得任何进展。一篇帖子说需要抵消,但这也不起作用。

在第二次尝试时,我尝试了 qemu-nbd

touch /dev/nbd1
qemu-nbd -c /dev/nbd1 ./centoOS7Python3p9_tmp-disk1.vdi 

我收到错误:

nbd.c:nbd_init():L611: Failed to set NBD socket

如果我尝试:

modprobe nbd max_part=8

我收到错误:

modprobe: FATAL: Module nbd not found.

我读到 CentOS 已禁用 nbd 支持,但我不知道如何启用 nbd。

在第三次尝试时,我使用 guestmount:

guestmount -a ./centoOS7Python3p9_tmp-disk1.vdi -i --ro /dev/oldHd

我收到错误:

libguestfs: error: could not create appliance through libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: Cannot access backing file '/home/brian/centoOS7Python3p9_tmp-disk1.vdi' of storage file '/tmp/libguestfs9LUDJB/overlay1.qcow2' (as uid:107, gid:107): Permission denied [code=38 int1=13]

当我尝试“ export LIBGUESTFS_BACKEND=direct”时出现错误:

guestmount -a ./centoOS7Python3p9_tmp-disk1.vdi -i --ro /dev/oldHd
libguestfs: error: appliance closed the connection unexpectedly.
This usually means the libguestfs appliance crashed.
Do:
  export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again.  For further information, read:
  http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.
libguestfs: error: guestfs_launch failed.
This usually means the libguestfs appliance failed to start or crashed.
Do:
  export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again.  For further information, read:
  http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.

相关内容