导航

vbox下创建共享存储

Posted on 2016-01-20 22:32  datalife  阅读(470)  评论(0编辑  收藏  举报

1、创建共享盘
VBoxManage.exe createhd -filename D:\VM\linux01\ocr_vote.vdi -size 2048 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:\VM\linux01\data01.vdi -size 10240 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:\VM\linux01\data02.vdi -size 10240 -format VDI -variant Fixed

2.将共享磁盘信息写入到每个虚拟磁盘文件的文件头,在使用的时候就无需再设置成共享。
vboxmanage modifyhd D:\VM\linux01\ocr_vote.vdi --type shareable
vboxmanage modifyhd D:\VM\linux01\data01.vdi --type shareable
vboxmanage modifyhd D:\VM\linux01\data02.vdi --type shareable

3.将创建完的磁盘连接至虚拟机的节点上。
节点1:
VBoxManage.exe storageattach linux01 --storagectl "SATA" --port 1 --device 0 --type hdd --medium D:\VM\linux01\ocr_vote.vdi --mtype shareable
VBoxManage.exe storageattach linux01 --storagectl "SATA" --port 2 --device 0 --type hdd --medium D:\VM\linux01\data01.vdi --mtype shareable
VBoxManage.exe storageattach linux01 --storagectl "SATA" --port 3 --device 0 --type hdd --medium D:\VM\linux01\data02.vdi --mtype shareable
节点2:
VBoxManage.exe storageattach linux02 --storagectl "SATA" --port 1 --device 0 --type hdd --medium D:\VM\linux01\ocr_vote.vdi --mtype shareable
VBoxManage.exe storageattach linux02 --storagectl "SATA" --port 2 --device 0 --type hdd --medium D:\VM\linux01\data01.vdi --mtype shareable
VBoxManage.exe storageattach linux02 --storagectl "SATA" --port 3 --device 0 --type hdd --medium D:\VM\linux01\data02.vdi --mtype shareable