Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure shared storage and bind UDEV storage devices

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to configure shared storage and bind UDEV storage devices. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Configure shared storage and UDEV storage device binding

Monday, July 29, 2013

Table of contents:

1.vrh2 New disk

2.vrh3 add existing disk

3. Bind storage disks on vrh2

3.1dividing the sdb 3G disk into two partitions

3.2 bind disk sdb

Binding sdc, sdd and sde to asm file format

4. Bind storage disks on vrh3

4.1 start vrh3

4.2 copy the rule file on the vrh2 you just configured to vrh3

4.3 start the service

Mutual trust configuration between 5.vrh2 and vrh3 sshd

5.1Execution on vrh2

5.2 execute on vrh3

5.3 create a license file to store the authorization information for two hosts

5.4 check the time synchronization of hosts on vrh2

5.5 check the time synchronization of hosts on vrh3

1.vrh2 New disk

Prerequisite: the vrh3 host needs to be shut down

A shared disk must use a fixed size disk type, otherwise it cannot be set to a shared type

Disk name creation type format disk type size description ocr New VDI fixed size 3G Placement OCR and vodvoting Diskdbshare1 New VDI fixed size 5G Placement data File dbshare2 New VDI fixed size 5G Placement data File dbshare3 New VDI fixed size 5G Placement data File

Set the above four disks to a sharable type

Click "manage"-> "Virtual Media Management"-> Select disk-> Select Type to share

There may be a slight delay in displaying on the virtual Box Manager

Open the host's iUnix O Cache

2.vrh3 add existing disk name create type format disk type size description ocr existing VDI fixed size 3G placement OCR and vodvoting Diskdbshare1 existing VDI fixed size 5G placement data file dbshare2 existing VDI fixed size 5G placement data file dbshare3 existing VDI fixed size 5G placement data file

Add a disk and open the host's Igamot O Cache

3. Bind storage disks on vrh2

3.1dividing the sdb 3G disk into two partitions

[root@vrh2 ~] # 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.

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

Command (m for help): P

Disk / dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): n

Command action

E extended

P primary partition (1-4)

P

Partition number (1-4): 1

First cylinder (1-391, default 1):

Using default value 1

Last cylinder or + size or + sizeM or + sizeK (1-391, default 391): + 1500 M

Command (m for help): P

Disk / dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sdb1 1 183 1469916 83 Linux

Command (m for help): n

Command action

E extended

P primary partition (1-4)

P

Partition number (1-4): 2

First cylinder (184391, default 184):

Using default value 184

Last cylinder or + size or + sizeM or + sizeK (184,391,391):

Using default value 391

Command (m for help): P

Disk / dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sdb1 1 183 1469916 83 Linux

/ dev/sdb2 184 391 1670760 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: Device or resource busy.

The kernel still uses the old table.

The new table will be used at the next reboot.

Syncing disks.

[root@vrh2 ~] # partprobe / dev/sdb

[root@vrh2 ~] # ls-l / dev/sdb*

Brw-r- 1 root disk 8, 16 Jul 29 07:39 / dev/sdb

B rw-r- 1 root disk 8 Jul 17 Jul 29 07:40 / dev/sdb1 # remember that binding will be used after 8 record17 8 and 18

B rw-r- 1 root disk 8, 18 Jul 29 07:40 / dev/sdb2 # Note the sdb here is still a block device, and we will set it as a raw device later

3.2 bind disk sdb

[root@vrh2 ~] # cd / etc/udev/rules.d/

[root@vrh2 rules.d] # vi 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.

ACTION== "add", KERNEL== "sdb1", RUN+= "/ bin/raw / dev/raw/raw1 N"

ACTION== "add", KERNEL== "sdb2", RUN+= "/ bin/raw / dev/raw/raw2 N"

ACTION== "add", KERNEL== "raw*", OWNER== "oracle", GROUP== "oinstall", MODE== "0660" # Grant permissions to oracle users and oinstall user groups

[root@vrh2 rules.d] # start_udev

Starting udev: [OK]

[root@vrh2 rules.d] # cd / dev/raw

[root@vrh2 raw] # ls-l

Total 0

Crw-rw---- 1 oracle oinstall 162, 1 Jul 29 07:56 raw1

Crw-rw---- 1 oracle oinstall 162, 2 Jul 29 07:56 raw2

Binding sdc, sdd and sde to asm file format

This can be done using the following script, which should be executed in the / dev/raw directory

For i in b c d e f g h i j k

Do

Echo "KERNEL==\" sd*\ ", BUS==\" scsi\ ", PROGRAM==\" / sbin/scsi_id-g-u-s% p\ ", RESULT==\" `scsi_id-g-u-s / block/sd$ i`\ ", NAME=\" asm-disk$i\ ", WNER=\" oracle\ ", GROUP=\" oinstall\ ", MODE=\" 0660\ ""

Done

We only have three cde disks here. We just need to write cde after the in.

Explanation:

Sbin/scsi_id-g-u this number is unique, so bind according to it

[root@vrh2 raw] # ls

Raw1 raw2

[root@vrh2 raw] # for i in c d e

> do

> echo "sd$i"`scsi_id-g-u-s / block/sd$ i`"

> done

Sdc SATA_VBOX_HARDDISK_VBb86af276-b24615a9_

Sdd SATA_VBOX_HARDDISK_VB453dbb62-ac2d0a41_

Sde SATA_VBOX_HARDDISK_VB2a60d1f8-c1fd7b46_

Execute script

[root@vrh2 raw] # for i in c d e

> do

> echo "KERNEL==\" sd*\ ", BUS==\" scsi\ ", PROGRAM==\" / sbin/scsi_id-g-u-s% p\ ", RESULT==\" `scsi_id-g-u-s / block/sd$ i`\ ", NAME=\" asm-disk$i\ ", WNER=\" oracle\ ", GROUP=\" oinstall\ ", MODE=\" 0660\ ""

> done

KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "SATA_VBOX_HARDDISK_VBb86af276-b24615a9_", NAME= "asm-diskc", OWNER= "oracle", GROUP= "oinstall", MODE= "0660"

KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "SATA_VBOX_HARDDISK_VB453dbb62-ac2d0a41_", NAME= "asm-diskd", OWNER= "oracle", GROUP= "oinstall", MODE= "0660"

KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "SATA_VBOX_HARDDISK_VB2a60d1f8-c1fd7b46_", NAME= "asm-diske", OWNER= "oracle", GROUP= "oinstall", MODE= "0660"

[root@vrh2 raw] #

[root@vrh2 ~] # cd / etc/udev/rules.d/

[root@vrh2 rules.d] # touch 99-oracle-asmdevices.rules

[root@vrh2 rules.d] # vi 99-oracle-asmdevices.rules

KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "SATA_VBOX_HARDDISK_VBb86af276-b24615a9_", NAME= "asm-diskc", OWNER= "oracle", GROUP= "oinstall", MODE= "0660"

KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "SATA_VBOX_HARDDISK_VB453dbb62-ac2d0a41_", NAME= "asm-diskd", OWNER= "oracle", GROUP= "oinstall", MODE= "0660"

KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s% p", RESULT== "SATA_VBOX_HARDDISK_VB2a60d1f8-c1fd7b46_", NAME= "asm-diske", OWNER= "oracle", GROUP= "oinstall", MODE= "0660"

[root@vrh2 rules.d] # start_udev

Starting udev: [OK]

[root@vrh2 rules.d] # ls-l / dev/asm*

Brw-rw---- 1 oracle oinstall 8, 32 Jul 29 20:30 / dev/asm-diskc

Brw-rw---- 1 oracle oinstall 8, 48 Jul 29 20:30 / dev/asm-diskd

Brw-rw---- 1 oracle oinstall 8, 64 Jul 29 20:30 / dev/asm-diske

4. Bind storage disks on vrh3

4.1 start vrh3

4.2 copy the rule file on the vrh2 you just configured to vrh3

[root@vrh2 rules.d] # scp 60-raw.rules vrh3:/etc/udev/rules.d

The authenticity of host 'vrh3 (192.168.1.103)' can't be established.

RSA key fingerprint is 92:e1:fc:a6:f8:15:37:27:7b:50:41:fa:be:4d:19:0b.

Are you sure you want to continue connecting (yes/no)? Yes

Warning: Permanently added 'vrh3192.168.1.103' (RSA) to the list of known hosts.

Root@vrh3's password:

60-raw.rules 100% 527 0.5KB/s 00:00

[root@vrh2 rules.d] # scp 99-oracle-asmdevices.rules vrh3:/etc/udev/rules.d

Root@vrh3's password:

99-oracle-asmdevices.rules 100% 544 0.5KB/s 00:00

4.3 start the service

[root@vrh3 rules.d] # start_udev

Starting udev: [OK]

[root@vrh3 rules.d] # ll / dev/raw/raw*

Crw-rw---- 1 oracle oinstall 162, 1 Jul 29 20:39 / dev/raw/raw1

Crw-rw---- 1 oracle oinstall 162, 2 Jul 29 20:39 / dev/raw/raw2

[root@vrh3 rules.d] #

[root@vrh3 rules.d] # ll / dev/asm*

Brw-rw---- 1 oracle oinstall 8, 32 Jul 29 20:39 / dev/asm-diskc

Brw-rw---- 1 oracle oinstall 8, 48 Jul 29 20:39 / dev/asm-diskd

Brw-rw---- 1 oracle oinstall 8, 64 Jul 29 20:39 / dev/asm-diske

Mutual trust configuration between 5.vrh2 and vrh3 sshd

5.1Execution on vrh2

[root@vrh2 /] # su-oracle

[oracle@vrh2] $ssh-keygen-t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/ home/oracle/.ssh/id_rsa):

Created directory'/ home/oracle/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in / home/oracle/.ssh/id_rsa.

Your public key has been saved in / home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

87:0f:5e:55:8e:7a:b6:47:e7:34:ad:27:b4:63:a9:da oracle@vrh2.oracle.com

[oracle@vrh2] $ssh-keygen-t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/ home/oracle/.ssh/id_dsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in / home/oracle/.ssh/id_dsa.

Your public key has been saved in / home/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

0d:ec:9d:41:00:5d:cc:e7:c2:8a:e8:6c:30:00:90:66 oracle@vrh2.oracle.com

5.2 execute on vrh3

[root@vrh3 /] # su-oracle

[oracle@vrh3] $ssh-keygen-t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/ home/oracle/.ssh/id_rsa):

Created directory'/ home/oracle/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in / home/oracle/.ssh/id_rsa.

Your public key has been saved in / home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

83:a3:22:6a:aa:cf:90:74:11:7e:48:58:86:06:7b:aa oracle@vrh3.oracle.com

[oracle@vrh3] $ssh-keygen-t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/ home/oracle/.ssh/id_dsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in / home/oracle/.ssh/id_dsa.

Your public key has been saved in / home/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

29:3b:dc:1b:49:bb:0e:90:29:a7:d6:6b:26:99:de:b7 oracle@vrh3.oracle.com

5.3 create a license file to store the authorization information for two hosts

[oracle@vrh2 .ssh] $touch authorized_keys

[oracle@vrh2 .ssh] $cat id_dsa.pub > > authorized_keys # Save the dsa on the native vrh2 to the license file

[oracle@vrh2 .ssh] $cat id_rsa.pub > > authorized_keys # Save the rsa on the native vrh2 to the license file

[oracle@vrh2 .ssh] $ssh vrh3 cat ~ / .ssh/id_dsa.pub > > authorized_keys # Save the dsa on vrh3 to the license file

The authenticity of host 'vrh3 (192.168.1.103)' can't be established. # Save the rsa on vrh3 to the license file

RSA key fingerprint is 92:e1:fc:a6:f8:15:37:27:7b:50:41:fa:be:4d:19:0b.

Are you sure you want to continue connecting (yes/no)? Yes

Warning: Permanently added 'vrh3192.168.1.103' (RSA) to the list of known hosts.

Oracle@vrh3's password:

[oracle@vrh2 .ssh] $ssh vrh3 cat ~ / .ssh/id_rsa.pub > > authorized_keys # copy the license file to the vrh3 host

Oracle@vrh3's password:

[oracle@vrh2 .ssh] $scp authorized_keys vrh3:~/.ssh

Oracle@vrh3's password:

Authorized_keys 100% 2032 2.0KB/s 00:00

5.4 check the time synchronization of hosts on vrh2

[oracle@vrh2 .ssh] $date;ssh vrh3 date

Mon Jul 29 20:53:44 CST 2013

Mon Jul 29 20:53:44 CST 2013

[oracle@vrh2 .ssh] $date;ssh vrh3-priv date

Mon Jul 29 20:54:15 CST 2013

Mon Jul 29 20:54:15 CST 2013

[oracle@vrh2 .ssh] $date;ssh vrh2 date

Mon Jul 29 20:55:36 CST 2013

Mon Jul 29 20:55:36 CST 2013

[oracle@vrh2 .ssh] $date;ssh vrh2-priv date

Mon Jul 29 20:55:45 CST 2013

Mon Jul 29 20:55:45 CST 2013

5.5 check the time synchronization of hosts on vrh3

[oracle@vrh3 ~] $date;ssh vrh2 date

Mon Jul 29 20:56:50 CST 2013

Mon Jul 29 20:56:50 CST 2013

[oracle@vrh3 ~] $date;ssh vrh2-priv date

Mon Jul 29 20:56:59 CST 2013

Mon Jul 29 20:56:59 CST 2013

[oracle@vrh3 ~] $date;ssh vrh3 date

Mon Jul 29 20:57:54 CST 2013

Mon Jul 29 20:57:54 CST 2013

[oracle@vrh3 ~] $date;ssh vrh3-priv date

Mon Jul 29 20:57:45 CST 2013

Mon Jul 29 20:57:46 CST 2013

So much for how to configure shared storage and bind UDEV storage devices. I hope the above can help you and learn more. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report