开发者

How do I extract a file out of a virtual disk?

Given a block of data (which the filesystem thinks is the whole drive) and the type of filesystem (fat32, ntfs, ext3) I would like to know how to extract files out o开发者_Go百科f that block of data. Any ideas on how to do this?


You ultimately have two options:

  1. Mount the filesystem contained in the virtual disk image on the host machine. Tools like losetup can be helpful to accomplish this.
  2. Find an appropriate library that will allow you to poke at the volume in userspace. Basically, you want a user-mode filesystem driver that will let a program inspect the directory structure and extract files. You might be able to repurpose parts of fuse-ext2 and ntfs-3g.

This all assumes that the virtual disk is just a flat image file, not a specialized container like VMDK or VDI. If it is, you'll either need to extract the flat image or find a library that is capable of providing the flat content to other libraries.


You mount it to some point using

mount image /mount/point -o loop,ro

and access the files in it. Afterwards, you can unmount again.

But I do not understan what this has to do with C or C++.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜