VirtualBox之虚拟机更换目录
本文主要是在linux中安装VirtualBox后,使用VBoxManage配置虚拟机网络。本文命令支行环境如下:宿主机OS:fedora33VirtualBox版本:6.1.22虚拟机OS:CentOS7虚拟机name:centos-7-20210521
·
本文主要是在linux中安装VirtualBox后,使用VBoxManage配置虚拟机。
本文命令支行环境如下:
宿主机OS:fedora33
VirtualBox版本:6.1.22
虚拟机OS:CentOS7
虚拟机name:centos-7-20210521
如是只是虚拟机换了目录,比如,我这是就是把虚拟机的目录由“/root/VirtualBox VMs/”换到了“/mnt/git/VirtualBox-VMs/”
也就作了如下操作:
[root@localhost ~]# mv -f /root/'VirtualBox VMs'/* /mnt/git/VirtualBox-VMs/
[root@localhost ~]# VBoxManage registervm /mnt/git/VirtualBox-VMs/centos-7/centos-7-20210521/centos-7-20210521.vbox
[root@localhost centos-7-20210521]# VBoxManage list vms
"centos-7-20210521" {b09f4765-c719-4fe6-98bb-061a1e21c731}
[root@localhost centos-7-20210521]# VBoxManage startvm centos-7-20210521 --type headless
Waiting for VM "centos-7-20210521" to power on...
VBoxManage: error: Could not open the medium '/root/VirtualBox VMs/centos-7/centos-7.vdi'.
VBoxManage: error: VD: error VERR_FILE_NOT_FOUND opening image file '/root/VirtualBox VMs/centos-7/centos-7.vdi' (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium
[root@localhost centos-7-20210521]# VBoxManage list hdds
UUID: 239206ae-49a3-4ed6-abfd-11b65b068b60
Parent UUID: base
State: inaccessible
Type: normal (base)
Location: /root/VirtualBox VMs/centos-7/centos-7.vdi
Storage format: VDI
Capacity: 0 MBytes
Encryption: disabled
[root@localhost centos-7-20210521]# VBoxManage modifymedium disk 239206ae-49a3-4ed6-abfd-11b65b068b60 --setlocation /mnt/git/VirtualBox-VMs/centos-7/centos-7.vdi
Set new location of medium with UUID 239206ae-49a3-4ed6-abfd-11b65b068b60 finished
[root@localhost centos-7-20210521]# VBoxManage list hdds
UUID: 239206ae-49a3-4ed6-abfd-11b65b068b60
Parent UUID: base
State: created
Type: normal (base)
Location: /mnt/git/VirtualBox-VMs/centos-7/centos-7.vdi
Storage format: VDI
Capacity: 10240 MBytes
Encryption: disabled
[root@localhost ~]# VBoxManage storageattach centos-7-20210521 --storagectl SATA --port 0 --device 0 --type hdd --medium none
[root@localhost ~]# VBoxManage storageattach centos-7-20210521 --storagectl SATA --port 0 --device 0 --type hdd --medium "/mnt/git/VirtualBox-VMs/centos-7/centos-7.vdi"
更多推荐
已为社区贡献8条内容
所有评论(0)