虛擬機器配置共享磁碟

dbahaoyuan發表於2014-12-06

虛擬機器版本:VMware Workstation 10

1、建立4塊磁碟

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager -c -s 1G -a

 lsilogic -t 2 E:\oracle11g_rac_sharedisk\vote.vmdk

VixDiskLib: Invalid configuration file parameter.  Failed to read configuration

file.

Creating disk 'E:\oracle11g_rac_sharedisk\vote.vmdk'

  Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager -c -s 1G -a

 lsilogic -t 2 E:\oracle11g_rac_sharedisk\ocr.vmdk

VixDiskLib: Invalid configuration file parameter.  Failed to read configuration

file.

Creating disk 'E:\oracle11g_rac_sharedisk\ocr.vmdk'

  Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager -c -s 10G -

a lsilogic -t 2 E:\oracle11g_rac_sharedisk\data.vmdk

VixDiskLib: Invalid configuration file parameter.  Failed to read configuration

file.

Creating disk 'E:\oracle11g_rac_sharedisk\data.vmdk'

  Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager -c -s 10G -

a lsilogic -t 2 E:\oracle11g_rac_sharedisk\flash.vmdk

VixDiskLib: Invalid configuration file parameter.  Failed to read configuration

file.

Creating disk 'E:\oracle11g_rac_sharedisk\flash.vmdk'

  Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>

 

2、往虛擬機器新增硬碟,結果狀態如下圖


 

3、修改檔案

分別在兩個虛擬機器的配置檔案中加入如下內容

disk.locking = "false"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.DataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize = "4096"

diskLib.maxUnsyncedWrites = "0"

scsi1:0.deviceType = "disk"

scsi1:1.deviceType = "disk"

scsi1:2.deviceType = "disk"

scsi1:3.deviceType = "disk"

scsi1.sharedBus = "VIRTUAL"

4、磁碟分割槽、格式化及載入

[root@rac1 ~]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0xddb38873.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 

Value out of range.

Partition number (1-4): 1

First cylinder (1-1305, default 1): 

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): 

Using default value 1305

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

[root@rac1 ~]# mkfs.ext3 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

655360 inodes, 2620595 blocks

131029 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2684354560

80 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

 

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 30 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

[root@rac1 ~]# mount /dev/sdb1 /mnt/sdb1/

[root@rac1 ~]# df -lh

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda2              22G  5.3G   16G  26% /

tmpfs                1000M  100K 1000M   1% /dev/shm

/dev/sda1             3.9G   92M  3.6G   3% /boot

/dev/sdb1             9.9G  151M  9.2G   2% /mnt/sdb1

對其他磁碟重複以上操作

 

 

 

5、在第二臺虛擬機器上掛載相應磁碟

[root@rac2 ~]# fdisk -l

 

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0009cd88

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1         511     4096000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2             511        3407    23264256   83  Linux

/dev/sda3            3407        3917     4096000   82  Linux swap / Solaris

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xddb38873

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        1305    10482381   83  Linux

 

Disk /dev/sdc: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x824b7789

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1        1305    10482381   83  Linux

 

Disk /dev/sdd: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xe3ae100e

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1               1         130     1044193+  83  Linux

 

Disk /dev/sde: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xfb137d21

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sde1               1         130     1044193+  83  Linux

 

[root@rac2 mnt]# mount /dev/sdb1 /mnt/sdb1/

[root@rac2 mnt]# mount /dev/sdc1 /mnt/sdc1/

[root@rac2 mnt]# mount /dev/sdd1 /mnt/sdd1/

[root@rac2 mnt]# mount /dev/sde1 /mnt/sde1/

[root@rac2 mnt]# df -lh

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda2              22G  5.2G   16G  25% /

tmpfs                1000M  100K 1000M   1% /dev/shm

/dev/sda1             3.9G   92M  3.6G   3% /boot

/dev/sdb1             9.9G  151M  9.2G   2% /mnt/sdb1

/dev/sdc1             9.9G  151M  9.2G   2% /mnt/sdc1

/dev/sdd1            1004M   18M  936M   2% /mnt/sdd1

/dev/sde1            1004M   18M  936M   2% /mnt/sde1

 

6、修改配置檔案

[root@rac1 ~]# vi /etc/rc.local 

新增如下內容

mount /dev/sdb1 /mnt/sdb1/

mount /dev/sdc1 /mnt/sdc1/

mount /dev/sdd1 /mnt/sdd1/

mount /dev/sde1 /mnt/sde1/

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29337971/viewspace-1075391/,如需轉載,請註明出處,否則將追究法律責任。

相關文章