【三】建立本地盘和共享盘
3.1 添加本地磁盘(动态)
Node1:
添加20G本地盘(/u01),添加磁盘虚拟机需要处于关闭状态。
[root@tim1 ~]# shutdown -h now
添加SCSI盘,注意规范,磁盘叫node1-disk2.vdi,放在/RAC/node1的目录下。
Node2:同上
1)建立共享磁盘
Node1:
注意规范,磁盘叫sharedisk.vdi,放在/RAC/sharedisk的目录下。
设置为可共享。
2)识别共享盘
Node2:
3)验证共享盘,启动两节点,node1先启动,node2随后再启动。
检查两节点都能看到同一块共享盘
[root@tim1 ~]# ls -al /dev/sd*[root@tim2 ~]# ls -al /dev/sd*
sda表示第一块磁盘
sda1表示第一块磁盘的第一个分区
sda2表示第一块磁盘的第二个分区
sdb表示第二块磁盘
sdc 表示第三块磁盘
3.3分区并格式化本地盘(这就是/u01)
Node1:
整个一个区都给它:
[root@tim1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent won't be recoverable.The number of cylinders for this disk is set to 2610.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)Command (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First cylinder (1-2610, default 1): enterUsing default value 1Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):Using default value 2610Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.
Node2:同上
共10个分区(1+1+1)+(5+5)+(4+4)+(3+3+3)=30G
Node1:
[root@tim1 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent won't be recoverable.The number of cylinders for this disk is set to 3916.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)Command (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First cylinder (1-3916, default 1): enterUsing default value 1Last cylinder or +size or +sizeM or +sizeK (1-3916, default 3916): +1GCommand (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 2First cylinder (124-3916, default 124):enterUsing default value 124Last cylinder or +size or +sizeM or +sizeK (124-3916, default 3916): +1GCommand (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 3First cylinder (247-3916, default 247):enterUsing default value 247Last cylinder or +size or +sizeM or +sizeK (247-3916, default 3916): +1GCommand (m for help): nCommand actione extendedp primary partition (1-4)e 开始扩展分区Selected partition 4First cylinder (370-3916, default 370):enterUsing default value 370Last cylinder or +size or +sizeM or +sizeK (370-3916, default 3916): enterUsing default value 3916Command (m for help): nFirst cylinder (370-3916, default 370):enterUsing default value 370Last cylinder or +size or +sizeM or +sizeK (370-3916, default 3916): +5GCommand (m for help): nFirst cylinder (979-3916, default 979):enterUsing default value 979Last cylinder or +size or +sizeM or +sizeK (979-3916, default 3916): +5GCommand (m for help): nFirst cylinder (1588-3916, default 1588):enterUsing default value 1588Last cylinder or +size or +sizeM or +sizeK (1588-3916, default 3916): +4GCommand (m for help): nFirst cylinder (2075-3916, default 2075):enterUsing default value 2075 enterLast cylinder or +size or +sizeM or +sizeK (2075-3916, default 3916): +4GCommand (m for help): nFirst cylinder (2562-3916, default 2562):enterUsing default value 2562Last cylinder or +size or +sizeM or +sizeK (2562-3916, default 3916): +3GCommand (m for help): nFirst cylinder (2928-3916, default 2928):enterUsing default value 2928Last cylinder or +size or +sizeM or +sizeK (2928-3916, default 3916): +3GCommand (m for help): nFirst cylinder (3294-3916, default 3294): enterUsing default value 3294Last cylinder or +size or +sizeM or +sizeK (3294-3916, default 3916): +3GCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.
Node2: 不需做共享分区,能看到共享盘就行了。
两个节点看到磁盘分区是一模一样的,如果Node2看不到盘,可能需要查探一下。
[root@tim2 dev]# partprobe /dev/sdc
3.5将本地盘/dev/sdb1分别格式化,然后自动挂载:
Node1:
[root@tim1 ~]# mkfs.ext3 /dev/sdb1[root@tim1 ~]# mount /dev/sdb1 /u01[root@tim3 ~]# df[root@tim1 ~]# vi /etc/fstab
最后一行添加,下次启动有效:
/dev/sdb1 /u01 ext3 defaults 0 0
Node2:同上
【注】:/etc/fstab描述一定要正确,否则启动无法完成。
Node1:
swap分区大小的设置:一般要求为内存的2倍。
[root@tim1 ~]# free –m 查看内存空间分配[root@tim1 ~]# df –h 查看磁盘空间分配[root@tim1 ~]# ls –al /u01 查看/u01下文件信息
1)先用dd命令生成一个空文件,把它放在/u01下,单位1024m,设置2G。
【注】:新添swap不要放到根目录消耗根空间,另外bs的单位M要大写,名字随便。
[root@tim1 ~]# dd if=/dev/zero of=/u01/swap1 bs=1M count=2048
2)创建一个swap类型文件。
[root@tim1 ~]# mkswap /u01/swap1
3)将swpf1生成swap文件。
[root@tim1 ~]# swapon /u01/swap1
查看一下,swap1起作用了。
[root@tim1 ~]# free –m
4)实现开机后自动使用新添的swap1分区。
[root@tim1 ~]# vi /etc/fstab
添加swap行
/u01/swap1 swap swap defaults 0 0
5)修改tmpfs行。
tmpfs /dev/shm tmpfs defaults,size=2G 0 0
6)tmpfs重置一下,使其当下有效。
[root@tim1 ~]# mount -o remount /dev/shm
tmpfs一般设为交换区大小的一半。
Node2:同上
3.7检测配置状态。
the end !!!
@jackman 共筑美好!
留言与评论(共有 0 条评论) “” |