VirtualBox + linux 5.8 + oracle 11GR2 rac 的时候我们需要化块盘来做共享存储,以下是具体的做法
[root@node1 ~]# ls
anaconda-ks.cfg Desktop install.log install.log.syslog
[root@node1 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8, 0 03-21 20:30 /dev/sda
brw-r----- 1 root disk 8, 1 03-21 20:31 /dev/sda1
brw-r----- 1 root disk 8, 2 03-21 20:31 /dev/sda2
brw-r----- 1 root disk 8, 3 03-21 20:30 /dev/sda3
brw-r----- 1 root disk 8, 16 03-21 20:31 /dev/sdb
[root@node1 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 24G 3.1G 19G 14% /
/dev/sda1 99M 22M 73M 23% /boot
tmpfs 1.5G 0 1.5G 0% /dev/shm
[root@node1 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3133 25061400 83 Linux
/dev/sda3 3134 3916 6289447+ 82 Linux swap / Solaris
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
[root@node1 ~]# fdisk
Usage: fdisk [-l] [-b SSZ] [-u] device
E.g.: fdisk /dev/hda (for the first IDE disk)
or: fdisk /dev/sdc (for the third SCSI disk)
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
...
[root@node1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 1044.
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): 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-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@node1 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8, 0 03-21 20:30 /dev/sda
brw-r----- 1 root disk 8, 1 03-21 20:31 /dev/sda1
brw-r----- 1 root disk 8, 2 03-21 20:31 /dev/sda2
brw-r----- 1 root disk 8, 3 03-21 20:30 /dev/sda3
brw-r----- 1 root disk 8, 16 03-21 20:40 /dev/sdb
brw-r----- 1 root disk 8, 17 03-21 20:40 /dev/sdb1
这个时候我们去看下节点2上面有没有认这块盘
# ls -l /dev/sd*
# fdisk /dev/sdb
p
在每个节点上修改
[root@node1 etc]# cd udev/
[root@node1 udev]# ls
makedev.d rules.d scripts udev.conf
[root@node1 udev]# cd rules.d/
[root@node1 rules.d]# ls
05-udev-early.rules 60-net.rules 61-uinput-stddev.rules 90-alsa.rules 98-kexec.rules
40-multipath.rules 60-pcmcia.rules 61-uinput-wacom.rules 90-dm.rules bluetooth.rules
50-udev.rules 60-raw.rules 85-pcscd_ccid.rules 90-hal.rules
51-hotplug.rules 60-wacom.rules 88-clock.rules 95-pam-console.rules
[root@node1 rules.d]# cat 60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
[root@node1 rules.d]# vim 60-raw.rules
"60-raw.rules"
"60-raw.rules" 7L, 316C# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
~ 1,1 全部7,1 7,2 7,3 7,4 7,5 7,6 7,7 7,8 7,9 7,10 -- 插入 --8,1 全部ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
KERNEL=="raw1",OWNER="grid",GROUP="asmadmin",MODE="660"9,56 9,55 全部:w
:wq
:wq!
:wq!
"60-raw.rules"
"60-raw.rules" 9L, 434C 已写入
[root@node1 rules.d]# cat
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
KERNEL=="raw1",OWNER="grid",GROUP="asmadmin",MODE="660"
[root@node1 rules.d]# pwd
/etc/udev/rules.d
[root@node1 rules.d]# start_udev
启动 udev:[确定]
去验证
[oracle@node1 ~]$ ls -l /dev/raw/raw1
crw-rw---- 1 grid asmadmin 162, 1 03-21 20:49 /dev/raw/raw1
节点2上
$ ls -l /dev/raw/raw1