1、创建共享盘
VBoxManage.exe createhd -filename D:VMlinux01ocr_vote.vdi -size 2048 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:VMlinux01data01.vdi -size 10240 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:VMlinux01data02.vdi -size 10240 -format VDI -variant Fixed
2.将共享磁盘信息写入到每个虚拟磁盘文件的文件头,在使用的时候就无需再设置成共享。
vboxmanage modifyhd D:VMlinux01ocr_vote.vdi --type shareable
vboxmanage modifyhd D:VMlinux01data01.vdi --type shareable
vboxmanage modifyhd D:VMlinux01data02.vdi --type shareable
3.将创建完的磁盘连接至虚拟机的节点上。
节点1:
VBoxManage.exe storageattach linux01 --storagectl "SATA" --port 1 --device 0 --type hdd --medium D:VMlinux01ocr_vote.vdi --mtype shareable
VBoxManage.exe storageattach linux01 --storagectl "SATA" --port 2 --device 0 --type hdd --medium D:VMlinux01data01.vdi --mtype shareable
VBoxManage.exe storageattach linux01 --storagectl "SATA" --port 3 --device 0 --type hdd --medium D:VMlinux01data02.vdi --mtype shareable
节点2:
VBoxManage.exe storageattach linux02 --storagectl "SATA" --port 1 --device 0 --type hdd --medium D:VMlinux01ocr_vote.vdi --mtype shareable
VBoxManage.exe storageattach linux02 --storagectl "SATA" --port 2 --device 0 --type hdd --medium D:VMlinux01data01.vdi --mtype shareable
VBoxManage.exe storageattach linux02 --storagectl "SATA" --port 3 --device 0 --type hdd --medium D:VMlinux01data02.vdi --mtype shareable