虚拟机磁盘移动位置后失效解决办法
http://forums.gentoo.org/viewtopic-t-908100-start-0.html
i have been using VirtualBox for W7 on my Gentoo
machine, without any problems for quite some time.
I have given my
virtual disk /mnt/w7/Windows_7.vdi a separate partition /dev/hda1 of size 26 GB.
Now the size of the virtual disk has grown and I need more disk space. I have
installed a new SATA SSD of size 120 GB an mounted it under
/mnt/vb_w7/
My intention has been to move the virtual disk to the
new SSD. I did the follwing steps to move the virtual disk:
1.
cloned the virtual disk to the new location
代码: |
# /opt/bin/VBoxManage clonehd /mnt/w7/Windows_7.vdi
/mnt/vb_w7/Windows_7.vdi 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone hard disk created in format ‘VDI‘. UUID: 0c0f2877-96e9-4455-8629-58957d70ee23 |
2. Released the old virtual disk, through the
VB GUI
代码: |
Menu -> Virtual Media Manager -> Right Click -> Release |
3. Choose the new location of the (cloned)
virtual disk, through the VB GUI
代码: |
Settings -> Storage -> Click on SATA Controller -> Right Click and Add Hard Disk -> Choose Existing disk -> brows to the new virtual disk location/mnt/vb_w7/Windows_7.vdi) -> Open |
Here I get an error message from
VirtualBox:
引用: |
"Failed to open the hard disk
/mnt/vb_w7/Windows_7.vdi The medium ‘/mnt/vb_w7/Windows_7.vdi‘ can‘t be used as requested device type. Details: Result Code: NS_ERROR_FAILURE (0x80004005) Component: Medium Interface: IMedium {9edda847-1279-4b0a-9af7-9d66251ccc18} Callee: IVirtualBox {d2de270c-1d4b-4c9e-843f-bbb9b47269ff} |
I have done the steps according to the VB
Manual. I have unfortunately no clue how to solve this.
When I
examine the original virtual disk (/mnt/w7/Windows_7.vdi) and the cloned one
(/mnt/vb_w7/Windows_7.vdi) the cloned one seems OK with the VBoxManage
tool:
代码: |
phils_pc philip # /opt/bin/VBoxManage showhdinfo
/mnt/w7/Windows_7.vdi UUID: 5fce96ff-44d9-485d-93b1-c6d873a6ef90 Accessible: yes Logical size: 20480 MBytes Current size on disk: 20480 MBytes Type: normal (base) Storage format: VDI Format variant: fixed default Location: /mnt/w7/Windows_7.vdi |
and
代码: |
phils_pc philip # /opt/bin/VBoxManage showhdinfo
/mnt/vb_w7/Windows_7.vdi UUID: 0c0f2877-96e9-4455-8629-58957d70ee23 Accessible: yes Logical size: 20480 MBytes Current size on disk: 19668 MBytes Type: normal (base) Storage format: VDI Format variant: dynamic default Location: /mnt/vb_w7/Windows_7.vdi |
S O L V E D:
The
problem was that the permissions for the virtual disk file was changed when
cloning the disk.
Here are the complete sequence, in 6 steps, for a
successful change of location for the virtual machine files and the virtual
disk:
Original location /mnt/w7 (on /dev/hda1) and destination
/mnt/vb_w7/ (on /dev/sda1)
Step 1:
Use the VBoxManage tool
to clone the virtual disk in order to provide it a new UUID. Give the cloned
disk a new name in the same step
代码: |
/opt/bin/VBoxManage clonehd /mnt/w7/Windows_7.vdi /mnt/vb_w7/Win_7.vdi |
Just copy the file to the new location does
not work, because VirtualBox needs a unique UUID for the virtual disk
file.
New UUID is:
14a33a14-cac3-4e5b-ae13-72f33be7181b
Step 2:
Modify the
permission right to the file (virtual disk)
代码: |
# chmod 777 /mnt/vb_w7/Win_7.vdi |
in order for VirtualBox to recognize the file as a
disk
Step 3:
Expand the capacity of the virtual disk to
100 GB (102400 MB)
代码: |
# cp /mnt/w7/Windows\ 7/ /mnt/vb_w7/ |
Step 4:
Re-configure the virtual
machine (named Window 7) to point to the new directory and to attach the cloned
disk
In the VirtualBox GUI:
代码: |
Menu -> Virtual Media Manager -> Right Click -> Release |
and
代码: |
Settings -> Storage -> Click on SATA Controller -> Right Click and Add Hard Disk -> Choose Existing disk -> brows to the new virtual disk location/mnt/vb_w7/Win_7.vdi) -> Open |
Step 5:
Re-configure the virtual
machin (named “Windows 7” in my case) to point to the new directory for the
snapshots
代码: |
General → Advanced → Snapshot folder → “/mnt/vb_w7/Windows 7” |
A final check of the virtual disk
size:
代码: |
# /opt/bin/VBoxManage showhdinfo
/mnt/vb_w7/Win_7.vdi UUID: 14a33a14-cac3-4e5b-ae13-72f33be7181b Accessible: yes Logical size: 102400 MBytes Current size on disk: 19669 MBytes Type: normal (base) Storage format: VDI Format variant: dynamic default Location: /mnt/vb_w7/Win_7.vdi |
Step 6:
Extend the hard disk space in
W7
Start the virtual machine to boot into Windows 7 on the newly
attached VDI.
代码: |
Go to Start–>Control Panel–>Administrative Tools–>Computer Management In Computer Management–>Disk Management, choose your system drive(Boot), right click on it and choose "Extend Volume" |
_________________
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。