linux下vbox共享存储划分

linux下vbox共享存储划分

1.用VirtualBox的VBoxManage工具创建磁盘
vboxmanage createhd -filename /data2/vbox/sharedisk/vd1.vdi -size 1024 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/vd2.vdi -size 1024 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/vd3.vdi -size 1024 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/vd4.vdi -size 1024 -format VDI -variant Fixed

vboxmanage createhd -filename /data2/vbox/sharedisk/sd1.vdi -size 16384 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/sd2.vdi -size 16384 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/sd3.vdi -size 16384 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/sd4.vdi -size 16384 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/sd5.vdi -size 16384 -format VDI -variant Fixed
vboxmanage createhd -filename /data2/vbox/sharedisk/sd6.vdi -size 16384 -format VDI -variant Fixed

2.将共享磁盘信息写入到每个虚拟磁盘文件的文件头,在使用的时候就无需再设置成共享。
vboxmanage modifyhd /data2/vbox/sharedisk/vd1.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/vd2.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/vd3.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/vd4.vdi --type shareable

vboxmanage modifyhd /data2/vbox/sharedisk/sd1.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/sd2.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/sd3.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/sd4.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/sd5.vdi --type shareable
vboxmanage modifyhd /data2/vbox/sharedisk/sd6.vdi --type shareable

3.将创建完的磁盘连接至虚拟机的节点上。
节点1:
vboxmanage storageattach racnode1 --storagectl "SATA" --port 1 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd1.vdi --mtype shareable
vboxmanage storageattach racnode1 --storagectl "SATA" --port 2 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd2.vdi --mtype shareable
vboxmanage storageattach racnode1 --storagectl "SATA" --port 3 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd3.vdi --mtype shareable
vboxmanage storageattach racnode1 --storagectl "SATA" --port 4 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd4.vdi --mtype shareable

vboxmanage storageattach racnode1 --storagectl "SATA" --port 5 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd1.vdi --mtype shareable
vboxmanage storageattach racnode1 --storagectl "SATA" --port 6 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd2.vdi --mtype shareable
vboxmanage storageattach racnode1 --storagectl "SATA" --port 7 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd4.vdi --mtype shareable
vboxmanage storageattach racnode1 --storagectl "SATA" --port 8 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd5.vdi --mtype shareable
vboxmanage storageattach racnode1 --storagectl "SATA" --port 9 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd6.vdi --mtype shareable

节点2:
vboxmanage storageattach racnode2 --storagectl "SATA" --port 1 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd1.vdi --mtype shareable
vboxmanage storageattach racnode2 --storagectl "SATA" --port 2 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd2.vdi --mtype shareable
vboxmanage storageattach racnode2 --storagectl "SATA" --port 3 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd3.vdi --mtype shareable
vboxmanage storageattach racnode2 --storagectl "SATA" --port 4 --device 0 --type hdd --medium /data2/vbox/sharedisk/vd4.vdi --mtype shareable

vboxmanage storageattach racnode2 --storagectl "SATA" --port 5 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd1.vdi --mtype shareable
vboxmanage storageattach racnode2 --storagectl "SATA" --port 6 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd2.vdi --mtype shareable
vboxmanage storageattach racnode2 --storagectl "SATA" --port 7 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd4.vdi --mtype shareable
vboxmanage storageattach racnode2 --storagectl "SATA" --port 8 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd5.vdi --mtype shareable
vboxmanage storageattach racnode2 --storagectl "SATA" --port 9 --device 0 --type hdd --medium /data2/vbox/sharedisk/sd6.vdi --mtype shareable

你可能感兴趣的:(linux下vbox共享存储划分)