本帖最后由 种过一豆 于 2011-5-17 15:56 编辑
具体的差分磁盘准确定义我就不想说了,我也说不出来,更懒得去刨根揪底追着名词代号跑
不过大概要知道是怎么回事:就是在以一个母本为基础的前提上通过各种方法实现多个独立运行,各独立系统内的操作不影响其它系统,跟vhd vmware的母盘一样,virtualbox中那个最基础的母盘也应该要保持独立,如果母盘都出现被改动了那将是一个毁灭性的后果,当然这个直接修改成只读好像是不行的,我做了试验,最后还是通过手册里面的磁盘格式转换实现的
说下我的初步想法(当然这个初步的想法也被实践证实是不可行的)
直接新建一个虚拟机 a,在选择磁盘的时候直接指定原来已经存在的xp虚拟磁盘系统,期间没有做任何额外的设置
服务器磁盘故障的缘故,现在对上传图片有种恐惧症(怕等下又什么都看不见了),就不传太多的图了,有兴趣的就当“天书”蛮看吧
启动后先运行原来的xp,后运行a,发现两个都可以运行,不过也碰到了先启动后面新建的虚拟机a 然后启动xp无法运行的现象(直接提示报错了),而且如果先启动xp的虚拟机,在里面随便创建一个文档的话,打开基于母盘的虚拟机a会发现a里面也有这个文档
----------------相互之间有影响了------------------------
>>>>--------------很明显,这不是我想要的结果-----------
细心的你可能发现了我上面那张图的虚拟磁盘系统为 normal 格式
没错,翻了下手册第八章
VBoxManage modifyhdWith the modifyhd command, you can change the characteristics of a disk image after it has been created:
VBoxManage modifyhd <uuid>|<filename> [--type normal|writethrough|immutable|shareable| readonly|multiattach] [--autoreset on|off] [--compact] [--resize <megabytes>|--resizebyte <bytes>]NoteDespite the "hd" in the subcommand name, the command works with all disk images, not only hard disks. For compatibility with earlier versions of VirtualBox, the "modifyvdi" command is also supported and mapped internally to the "modifyhd" command.
The following options are available:
- With the --type argument, you can change the type of an existing image between the normal, immutable, write-through and other modes; see the section called “Special image write modes” for details.
- For immutable (differencing) hard disks only, the --autoreset on|off option determines whether the disk is automatically reset on every VM startup (again, see the section called “Special image write modes”). The default is "on".
- With the --compact option, can be used to compact disk images, i.e. remove blocks that only contains zeroes. This will shrink a dynamically expanding image again; it will reduce the physical size of the image without affecting the logical size of the virtual disk. Compaction works both for base images and for diff images created as part of a snapshot.
For this operation to be effective, it is required that free space in the guest system first be zeroed out using a suitable software tool. For Windows guests, you can use the sdelete tool provided by Microsoft. Execute sdelete -c in the guest to zero the free disk space before compressing the virtual disk image.
Please note that compacting is currently only available for VDI images. A similar effect can be achieved by zeroing out free blocks and then cloning the disk to any other dynamically expanding format. You can use this workaround until compacting is also supported for disk formats other than VDI. - The --resize option allows you to expand the capacity of an existing image; this increases the logical size of a virtual disk without affecting the physical size much.[32] This currently works only for the VDI and VHD formats, and only for the dynamically expanding variants. For example, if you originally created a 10G disk which is now full, you can use the --resize command to add more space to the virtual disk without having to create a new image and copy all data from within a virtual machine.
然后跳到第五章
- Next, immutable images
only remember write accesses temporarily while the virtual machine is running; all changes are lost when the virtual machine is powered on the next time. As a result, as opposed to "normal" images, the same immutable image can be used with several virtual machines without restrictions.
Creating an immutable image makes little sense since it would be initially empty and lose its contents with every machine restart (unless you really want to have a disk that is always unformatted when the machine starts up). As a result, normally, you would first create a "normal" image and then, when you deem its contents useful, later mark it immutable.
If you take a snapshot of a machine with immutable images, then on every machine power-up, those images are reset to the state of the last (current) snapshot (instead of the state of the original immutable image).
NoteAs a special exception, immutable images are not reset if they are attached to a machine whose last snapshot was taken while the machine was running (a so-called "online" snapshot). As a result, if the machine's current snapshot is such an "online" snapshot, its immutable images behave exactly like the "normal" images described previously. To re-enable the automatic resetting of such images, delete the current snapshot of the machine.
Again, technically, VirtualBox never writes to an immutable image directly at all. All write operations from the machine will be directed to a differencing image; the next time the VM is powered on, the differencing image is reset so that every time the VM starts, its immutable images have exactly the same content.[25] The differencing image is only reset when the machine is powered on from within VirtualBox, not when you reboot by requesting a reboot from within the machine. This is also why immutable images behave as described above when snapshots are also present, which use differencing images as well.
If the automatic discarding of the differencing image on VM startup does not fit your needs, you can turn it off using the autoreset parameter of VBoxManage modifyhd; see the section called “VBoxManage modifyhd” for details.
在这里找到了解决这个问题的思路
|