Recently, I found that there are more or less many problems in the online articles on creating a library with bare devices bound to linux lv, which is easy to mislead beginners. Therefore, I sorted out the preliminary steps for directly creating a library on a bare disk.
OS: RedHat 4.4
First, add a hard disk to the vmvm and enter the system to create a partition. We use sdc1 to divide the lv
[Root @ Oracle ~] # Fdisk-l-view existing partitions
Disk/dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sda1*262 2610 18868342 + 83 Linux
/Dev/sda2 1 261 2096451 82 Linux swap
Partition table entries are not in disk order
Disk/dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sdb1*1 2610 20964793 + 83 Linux
Disk/dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sdc1 1 2610 20964793 + 83 Linux
Create pv
[Root @ oracle ~] # Pvcreate/dev/sdc1-create pv
Physical volume "/dev/sdc1" successfully created
[Root @ oracle ~] # Pvdisplay/dev/sdc1-view pv Information
-Physical volume-
PV Name/dev/sdc1
VG Name oradata
PV Size 19.99 GB/not usable 0
Allocatable yes
PE Size (Kbytes) 4096
Total PE 5118
Free PE 4955
Allocated PE 163.
Pvuuid ol7T1b-telA-LOqC-Z0GR-ZGqN-f01o-QJT1KC
Create vg
[Root @ oracle ~] # Vgcreate oradata/dev/sdc1
Volume group "oradata" successfully created
[Root @ oracle ~] # Vgdisplay-view vg Information
-Volume group-
VG Name oradata
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
Max lv 0
Cur LV 5
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 19.99 GB
PE Size 4.00 MB
Total PE 5118
Alloc PE/Size 163/652 .00 MB
Free PE/Size 4955/19 .36 GB
Vg uuid Ohi2XZ-39PR-WH4m-WMgq-DyMY-eMZX-9CgbVi
Create lv
[Root @ oracle ~] # Lvcreate-n system01-L 200 M oradata
Logical volume "system01" created
[Root @ oracle ~] # Lvcreate-n undotbs01-L 200 M oradata
Logical volume "undotbs01" created
[Root @ oracle ~] # Lvcreate-n control01-L 50 M oradata
Logical volume "control01" created
[Root @ oracle ~] # Lvcreate-n redo01-L 100 M oradata
Logical volume "redo01" created
[Root @ oracle ~] # Lvcreate-n redo02-L 100 M oradata
Logical volume "redo02" created
View lv
[Root @ oracle ~] # Lvscan
ACTIVE '/dev/oradata/system01' [200.00 MB] inherit
"ACTIVE"/dev/oradata/undotbs "[200.00 MB] inherit
ACTIVE '/dev/oradata/redo01' [100.00 MB] inherit
ACTIVE '/dev/oradata/redo0' [100.00 MB] inherit
ACTIVE '/dev/oradata/control01' [52.00 MB] inherit
Empower
[Root @ oracle ~] # Cd/dev/mapper
[Root @ oracle mapper] # ll
Total 0
Crw --- 1 root 10, 63 Aug 21 control
Brw-rw -- 1 root 253, 4 Aug 21 oradata-control01
Brw-rw -- 1 root 253, 2 Aug 21 oradata-redo01
Brw-rw -- 1 root 253, 3 Aug 21 oradata-redo02
Brw-rw -- 1 root 253, 0 Aug 21 oradata-system01
Brw-rw -- 1 root 253, 1 Aug 21 18:21 oradata-undotbs
[Root @ oracle mapper] # chown-R oracle: oinstall/dev/mapper/oradata *
[Root @ oracle ~] # Cd/dev/mapper
[Root @ oracle mapper] # ll
Total 0
Crw --- 1 root 10, 63 Aug 21 control
Brw-rw -- 1 oracle oinstall 253, 4 Aug 21 oradata-control01
Brw-rw -- 1 oracle oinstall 253, 2 Aug 21 oradata-redo01
Brw-rw -- 1 oracle oinstall 253, 3 Aug 21 oradata-redo02
Brw-rw -- 1 oracle oinstall 253, 0 Aug 21 oradata-system01
Brw-rw -- 1 oracle oinstall 253, 1 Aug 21 oradata-undotbs
[Root @ oracle ~] # Cd/dev/oradata/
[Root @ oracle oradata] # ll
Total 0
Lrwxrwxrwx 1 root 29 Aug 21 control01->/dev/mapper/oradata-control01
Lrwxrwxrwx 1 root 26 Aug 21 18:22 redo01->/dev/mapper/oradata-redo01
Lrwxrwxrwx 1 root 26 Aug 21 18:22 redo02->/dev/mapper/oradata-redo02
Lrwxrwxrwx 1 root 28 Aug 21 18:20 system01->/dev/mapper/oradata-system01
Lrwxrwxrwx 1 root 27 Aug 21 18:21 undotbs->/dev/mapper/oradata-undotbs
Bind a bare Device
[Root @ oracle oradata] # raw/dev/raw/raw1/dev/mapper/oradata-system01-note that there is no/dev/raw directory before and will be automatically created after execution
Dev/raw/raw1: bound to major 253, minor 0
[Root @ oracle oradata] # raw/dev/raw/raw2/dev/mapper/oradata-undotbs1
Dev/raw/raw2: bound to major 253, minor 1
[Root @ oracle oradata] # raw/dev/raw/raw3/dev/mapper/oradata-redo01
Dev/raw/raw3: bound to major 253, minor 2
[Root @ oracle oradata] # raw/dev/raw/raw4/dev/mapper/oradata-redo02
Dev/raw/raw4: bound to major 253, minor 3
[Root @ oracle oradata] # raw/dev/raw/raw5/dev/mapper/oradata-control01
Dev/raw/raw5: bound to major 253, minor 4
To ensure that a bare device can be mounted after restart, modify the following file and add content
# This file and interface are deprecated.
# Applications needing raw device access shoshould open regular
# Block devices with O_DIRECT.
# Raw device bindings
# Format: <rawdev> <major> <minor>
# <Rawdev> <blockdev>
# Example:/dev/raw/raw1/dev/sda1
#/Dev/raw/raw2 8 5
/Dev/raw/raw1/dev/mapper/oradata-system01
/Dev/raw/raw2/dev/mapper/oradata-undotbs
/Dev/raw/raw3/dev/mapper/oradata-redo01
/Dev/raw/raw4/dev/mapper/oradata-redo02
/Dev/raw/raw5/dev/mapper/oradata-control01
Restart the bare device service to verify whether it can be mounted.
[Root @ oracle ~] #/Etc/init. d/rawdevices restart
Assigning devices:
/Dev/raw/raw1->/dev/mapper/oradata-system01
/Dev/raw/raw1: bound to major 253, minor 0
/Dev/raw/raw2->/dev/mapper/oradata-undotbs
/Dev/raw/raw2: boundto major 253, minor 1
/Dev/raw/raw3->/dev/mapper/oradata-redo01
/Dev/raw/raw3: bound to major 253, minor 2
/Dev/raw/raw4->/dev/mapper/oradata-redo02
/Dev/raw/raw4: boundto major 253, minor 3
/Dev/raw/raw5->/dev/mapper/oradata-control01
/Dev/raw/raw5: boundto major 253, minor 4
Done
Add permissions to the newly created bare device to enable oracle to use
[Root @ oracle ~] # Cd/dev/mapper
[Root @ oracle mapper] # ll
Total 0
Crw --- 1 root 10, 63 Aug 21 control
Brw-rw -- 1 oracle oinstall 253, 4 Aug 21 oradata-control01
Brw-rw -- 1 oracle oinstall 253, 2 Aug 21 oradata-redo01
Brw-rw -- 1 oracle oinstall 253, 3 Aug 21 oradata-redo02
Brw-rw -- 1 oracle oinstall 253, 0 Aug 21 oradata-system01
Brw-rw -- 1 oracle oinstall 253, 1 Aug 21 oradata-undotbs
[Root @ oracle mapper] # ls-l/dev/raw
Total 0
Crw-rw -- 1 root disk 162, 1 Aug 21 raw1
Crw-rw -- 1 root disk162, 2 Aug 21 19: 43 raw2
Crw-rw -- 1 root disk 162, 3 Aug 21 raw3
Crw-rw -- 1 root disk 162, 4 Aug 21 raw4
Crw-rw -- 1 root disk 162, 5 Aug 21 raw5
You cannot directly use chown-R oracle: oinstall/dev/raw * to modify the permissions in this region. Because files under/dev are dynamically created, therefore, after the OS is restarted, the owner will still become the root: disk. To solve this problem, you can write the above command into the 50-udev.permissions file, so that the owner can be changed again after each boot.
Modify the/etc/udev/permissions. d/50-udev.permissions File
Search by/raw
Set raw/*: root: disk: 0660
Modify raw/*: oracle: oinstall: 0660. This indicates that the default owner of the bare device is oracle: oinstall, and the default mode is 0660.
After modification, chown-R oracle: oinstall/dev/raw * is used to grant permissions.
[Root @ oracle ~] # Cd/dev/raw/
[Root @ oracle raw] # ll
Total 0
Crw-rw -- 1 oracle oinstall 162, 1 Aug 21 raw1
Crw-rw -- 1 oracle oinstall 162, 2 Aug 21 raw2
Crw-rw -- 1 oracle oinstall 162, 3 Aug 21 raw3
Crw-rw -- 1 oracle oinstall 162, 4 Aug 21 raw4
Crw-rw -- 1 oracle oinstall 162, 5 Aug 21 raw5
Then create a soft connection
[Oracle @ oracle prod2] $ pwd
/U01/app/oracle/oradata/prod2
[Oracle @ oracle prod2] $ ln-s/dev/raw/raw1 system01.dbf
[Oracle @ oracle prod2] $ ln-s/dev/raw/raw2 undotbs1.dbf
[Oracle @ oracle prod2] $ ln-s/dev/raw/raw3 redo01.rdo
[Oracle @ oracle prod2] $ ln-s/dev/raw/raw4 redo02.rdo
[Oracle @ oracle prod2] $ ln-s/dev/raw/raw5 control01.ctl
The subsequent database creation operations, whether you use manual database creation or dbca base creation, are similar. The key is to configure the lv and bind the bare device in linux.