设为首页 收藏本站
查看: 1364|回复: 0

[经验分享] Vmware虚拟机创建共享磁盘

[复制链接]

尚未签到

发表于 2015-10-8 12:11:26 | 显示全部楼层 |阅读模式
. 创建共享磁盘柜
   
在虚拟机软件的安装目录下,有个vmware-vdiskmanager.exe文件(老版本用plainmaker.exe),
   
把它复制到共享磁盘柜目录下,创建共享磁盘(老版本共享磁盘文件的扩展名为.pln
   
注:我的是windows 2003 R2 x64的系统

             D:/vmware
系统/共享磁盘> vmware-vdiskmanager.exe -c -s 200Mb -a lsilogic -t 2 quorum.vmdk
             D:/vmware
系统/共享磁盘> vmware-vdiskmanager.exe -c -s 4Gb -a lsilogic -t 2 sharedisk.vmdk

        
创建完毕后,目录下有四个新文件:
            quorum-flat.vmdk
            quorum.vmdk
            sharedisk-flat.vmdk
            sharedisk.vmdk



VMWARE虚拟机创建共享磁盘



VMWARE虚拟机创建共享磁盘

1.         
创建共享磁盘柜
在虚拟机软件的安装目录下,有个vmware-vdiskmanager.exe文件(老版本用plainmaker.exe),把它复制到共享磁盘柜目录下,创建共享磁盘(老版本共享磁盘文件的扩展名为.pln
F:/
虚拟机/共享磁盘柜>vmware-vdiskmanager.exe -c -s 200Mb -a lsilogic -t 2 quorum.vmdk
F:/
虚拟机/共享磁盘柜>vmware-vdiskmanager.exe -c -s 4Gb -a lsilogic -t 2 sharedisk.vmdk
创建完毕后,目录下有四个新文件
quorum-flat.vmdk
quorum.vmdk
sharedisk-flat.vmdk
sharedisk.vmdk
2.
配置虚拟机
在虚拟机器界面选择“Edit virtual machine settings”à添加硬盘,选“Use a existing virtual disk”,分别添加quorum.vmdksharedisk.vmdk
双击新加的磁盘,在弹出的磁盘属性窗选“advance”,为新加的硬盘选择虚拟设备节点:quorum.vmdk选订“SCSI 0:1” sharedisk.vmdk选定“SCSI 1:1”
如图所示:
分别打开两台虚拟机目录中的vmx文件,在最后一行添加: disk.locking="FALSE" scsi0:1.SharedBus="Virtual" scsi1:1.SharedBus="Virtual"
3.
配置Solaris1操作系统
启动两台虚拟机(主机名分别为clustera,clusterb
a.
clustera运行以下命令:
clustera# devfsadm
clustera# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@0,0/pci1000,30@10/sd@0,0
       1. c1t1d0
          /pci@0,0/pci1000,30@10/sd@1,0
       2. c2t1d0
          /pci@0,0/pci15ad,790@11/pci1000,30@2/sd@1,0
disk 1disk 2分别执行fdisk操作,创建100% solaris分区。然后再执行以下操作
# newfs /dev/rdsk/c2t1d0s2
# mkdir /oracle
# mount /dev/dsk/c2t1d0s2 /oracle
# touch /oracle/first.txt
b.
在另外一台虚拟机clusterb运行以下命令
clusterb# devfsadm
clusterb# mkdir /oracle
clusterb# mount /dev/dsk/c2t1d0s2 /oracle
clusterb# ls /oracle
first.txt   lost+found
clusterb上可以访问在clustera上创建的文件,共享磁盘创建完毕



                 VMWARE 虚拟机创建共享磁盘


1. 创建共享磁盘柜

   在虚拟机软件的安装目录下,有个vmware-vdiskmanager.exe文件(老版本用plainmaker.exe),

    把它复制到共享磁盘柜目录下,创建共享磁盘(老版本共享磁盘文件的扩展名为.pln

   注:我的是windows 2003 R2 x64的系统


             D:/vmware系统/共享磁盘> vmware-vdiskmanager.exe -c -s 200Mb -a lsilogic -t 2 quorum.vmdk

             D:/vmware系统/共享磁盘> vmware-vdiskmanager.exe -c -s 4Gb -a lsilogic -t 2 sharedisk.vmdk


        创建完毕后,目录下有四个新文件:

            quorum-flat.vmdk

            quorum.vmdk

            sharedisk-flat.vmdk

            sharedisk.vmdk


2.     配置虚拟机

      在虚拟机器界面选择“Edit virtual machine settings”à添加硬盘,选“Use a existing virtual disk”,

     分别添加quorum.vmdksharedisk.vmdk

      双击新加的磁盘,在弹出的磁盘属性窗选“advance”,为新加的硬盘选择虚拟设备节点:

             quorum.vmdk选订“SCSI 0:1”, sharedisk.vmdk选定“SCSI 1:1”。

  分别打开两台虚拟机目录中的vmx文件,在最后一行添加:

     disk.locking="FALSE"
    scsi0:1.SharedBus="Virtual"
    scsi1:1.SharedBus="Virtual"


vmware中设置共享磁盘,需要满足两个条件:

      1、硬盘的高级属性中必须设置成1:0,如果增加第二块共享硬盘,也设成1:0,系统就会报错,所以设置成1:1(这种方式本人还没试过,不过在oracle双机的文章中看到过这样的设置方法)
   
      2、需要在vmware的配置属性文件(如rhel3.vmx)中加入两条属性
        scsi[n].sharedBus = "virtual"   
        disk.locking = "false"  

      系统启动的时候会锁定磁盘,所以当启动linux1后共享磁盘被锁定了,linux2就起不来了,因此需要加入disk.locking = "false"   
   
       一般来说,如果是scsi1:0,则n1,也就是scsi1.sharedBus = "virtual"    ,表示所有的bus都共享,vmare推荐这种做法。


        如果说是不是所有的bus都共享的话,可以将上述scsi1.sharedBus = "virtual"改成scsi1:1.shared = "true"

SCSI reservation must be enabled in a virtual machine before you can share its disks. To enable it, make sure the virtual machine is powered off. Open the configuration file (.vmx file on Windows hosts, .cfg file on Linux hosts) in a text editor and add the line scsi[n].sharedBus = "virtual" anywhere in the file, where [n] is the SCSI bus being shared.

VMware recommends you set up the shared disks on their own SCSI bus, which is a different bus than the one the guest operating system uses. For example, if your guest operating system is on scsi0:0, you should set up disks to share on scsi1 bus.

For example, to enable SCSI reservation for devices on the scsi1 bus, add the following line to the virtual machine's configuration file:

scsi1.sharedBus = "virtual"

This gives the whole bus the ability to be shared. However, if you would rather not share the whole bus, you can selectively enable SCSI reservation for a specific SCSI disk on the shared bus. This prevents the locking of this specific disk. Add the following line to the configuration file:

scsi1:1.shared = "true"

If SCSI reservation is enabled (that is, scsi1.sharedBus is set to "virtual"), then this setting is ignored.

In addition to enabling SCSI reservation on the bus, you need to allow virtual machines to access the shared disk concurrently. Add the following line to the virtual machine's configuration file:

disk.locking = "false"

This setting permits multiple virtual machines to access a disk concurrently. Be careful though; if any virtual machine not configured for SCSI reservation tries to access this disk concurrently, then the shared disk is vulnerable to corruption or data loss.

When SCSI reservation is enabled, a reservation lock file that contains the shared state of the reservation for the given disk is created. The name of this file consists of the filename of the SCSI disk appended with .RESLCK.

For example, if the disk scsi1:0.filename is defined in the configuration file as

scsi1:0.fileName = "//vmSCSI.pln"

then the reservation lock file for this disk is given the default name

"//vmSCSI.pln.RESLCK"

However, you can provide your own lock file name. Add a definition for scsi1:0.reslckname to the configuration file. For example, if

scsi1:0.reslckname = "/tmp/scsi1-0.reslock"

is added to the configuration file, it overrides the default lock file name.


Selecting the Disk

Once SCSI reservation is enabled for a disk — that is, the scsi[n].sharedBus = "virtual" and disk.locking = "false" settings are added to the configuration file for each virtual machine wanting to share this disk, you need to point to this disk for each virtual machine that wants to access it.


Sharing a Disk on the scsi0 Bus


             版权声明:本文为博主原创文章,未经博主允许不得转载。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-124295-1-1.html 上篇帖子: Vmware 下共享文件夹(Windows到Linux) 下篇帖子: VirtualBox 和 Vmware 的比较(转)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表