VirtualBox之虚拟机更换目录

本文介绍了如何在Fedora 33系统上,将VirtualBox虚拟机目录从/root/VirtualBoxVMs/移动到/mnt/git/VirtualBox-VMs/,并详细记录了使用VBoxManage命令进行注册、列出虚拟机、启动虚拟机以及在遇到错误时如何修改硬盘路径,最终成功启动虚拟机的步骤。
摘要由CSDN通过智能技术生成

本文主要是在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"

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

purple.taro

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值