1、创建分区
[root@oel4 ~]# fdisk /dev/sdd
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 1305.
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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l
0 Empty 1e Hidden W95 FAT1 75 PC/IX be Solaris boot
1 FAT12 24 NEC DOS 80 Old Minix bf Solaris
2 XENIX root 39 Plan 9 81 Minix / old Lin c1 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 82 Linux swap c4 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 83 Linux c6 DRDOS/sec (FAT-
5 Extended 41 PPC PReP Boot 84 OS/2 hidden C: c7 Syrinx
6 FAT16 42 SFS 85 Linux extended da Non-FS data
7 HPFS/NTFS 4d QNX4.x 86 NTFS volume set db CP/M / CTOS / .
8 AIX 4e QNX4.x 2nd part 87 NTFS volume set de Dell Utility
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT
10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT
1c Hidden W95 FAT3
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
2、创建物理卷:
[root@oel4 ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created
[root@oel4 ~]# man lvcreate
3、创建逻辑卷组
[root@oel4 ~]# vgcreate vg01 /dev/sdd1
Volume group "vg01" successfully created
显示逻辑卷组信息
[root@oel4 ~]# vgdisplay
--- Volume group ---
VG Name vg01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 10.00 GB
PE Size 4.00 MB
Total PE 2559
Alloc PE / Size 0 / 0
Free PE / Size 2559 / 10.00 GB
VG UUID Xq3EQd-NWV6-aPr4-IH5N-GSH0-PrDR-NUChaS
4、创建逻辑卷
[root@oel4 ~]# lvcreate -L 112M -n control.ctl vg01
Logical volume "control.ctl" created
[root@oel4 ~]# cd /mapper
-bash: cd: /mapper: No such file or directory
[root@oel4 ~]# cd /dev/mapper
[root@oel4 mapper]# ll
total 0
crw------- 1 root root 10, 63 Dec 21 09:19 control
brw-rw---- 1 root disk 253, 0 Dec 21 09:50 vg01-control.ctl
[root@oel4 ~]# lvcreate -L 112M -n control01.ctl vg01
Logical volume "control01.ctl" created
[root@oel4 ~]# lvcreate -L 112M -n control02.ctl vg01
Logical volume "control02.ctl" created
[root@oel4 ~]# lvcreate -L 112M -n control03.ctl vg01
Logical volume "control03.ctl" created
[root@oel4 ~]# lvcreate -L 100M -n drsys01 vg01
Logical volume "drsys01" created
[root@oel4 ~]# lvcreate -L 100M -n index.dbf vg01
Logical volume "index.dbf" created
[root@oel4 ~]# lvcreate -L 120M -n redo01.log vg01
Logical volume "redo01.log" created
[root@oel4 ~]# lvcreate -L 120M -n redo02.log vg01
Logical volume "redo02.log" created
[root@oel4 ~]# lvcreate -L 120M -n redo03.log vg01
Logical volume "redo03.log" created
[root@oel4 ~]# lvcreate -L 51M -n spfile.dbf vg01
Rounding up size to full physical extent 52.00 MB
Logical volume "spfile.dbf" created
[root@oel4 ~]# lvcreate -L 2500M -n system01.dbf vg01
Logical volume "system01.dbf" created
[root@oel4 ~]# lvcreate -L 200M temp.dbf vg01
Volume group "temp.dbf" doesn't exist
[root@oel4 ~]# lvcreate -L 200M -n temp.dbf vg01
Logical volume "temp.dbf" created
[root@oel4 ~]# lvcreate -L 100M -n tools01.dbf vg01
Logical volume "tools01.dbf" created
[root@oel4 ~]# lvcreate -L 500M -n undotbs.dbf vg01
Logical volume "undotbs.dbf" created
[root@oel4 ~]# lvcreate -L 200M -n users.dbf vg01
Logical volume "users.dbf" created
[root@oel4 ~]# lvcreate -L 100M -n xdb01.dbf vg01
Logical volume "xdb01.dbf" created
5、配置裸设备
[root@oel4 ~]# vi /etc/sysconfig/rawdevices
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
# raw device bindings
# format:
#
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5
/dev/raw/raw02 /dev/mapper/vg01-control01.ctl
/dev/raw/raw03 /dev/mapper/vg01-control02.ctl
/dev/raw/raw04 /dev/mapper/vg01-control03.ctl
/dev/raw/raw05 /dev/mapper/vg01-index.dbf
/dev/raw/raw06 /dev/mapper/vg01-redo01.log
/dev/raw/raw07 /dev/mapper/vg01-redo02.log
/dev/raw/raw08 /dev/mapper/vg01-redo03.log
/dev/raw/raw09 /dev/mapper/vg01-spfile.dbf
/dev/raw/raw10 /dev/mapper/vg01-system01.dbf
/dev/raw/raw11 /dev/mapper/vg01-temp.dbf
/dev/raw/raw12 /dev/mapper/vg01-undotbs.dbf
/dev/raw/raw13 /dev/mapper/vg01-users.dbf
/dev/raw/raw14 /dev/mapper/vg01-drsys01
/dev/raw/raw15 /dev/mapper/vg01-tools01
/dev/raw/raw16 /dev/mapper/vg01-xdb01
6、重启服务生效
[root@oel4 ~]# service rawdevices restart
Assigning devices:
/dev/raw/raw02 --> /dev/mapper/vg01-control01.ctl
/dev/raw/raw2: bound to major 253, minor 1
/dev/raw/raw03 --> /dev/mapper/vg01-control02.ctl
。。。。。。。。。。。。。。。。
/dev/raw/raw15 --> /dev/mapper/vg01-tools01
Cannot locate block device '/dev/mapper/vg01-tools01' (No such file or directory)
/dev/raw/raw16 --> /dev/mapper/vg01-xdb01
Cannot locate block device '/dev/mapper/vg01-xdb01' (No such file or directory)
done
[root@oel4 mapper]# vi /etc/sysconfig/rawdevices
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
# raw device bindings
# format:
#
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5
/dev/raw/raw02 /dev/mapper/vg01-control01.ctl
/dev/raw/raw03 /dev/mapper/vg01-control02.ctl
/dev/raw/raw04 /dev/mapper/vg01-control03.ctl
/dev/raw/raw05 /dev/mapper/vg01-index.dbf
/dev/raw/raw06 /dev/mapper/vg01-redo01.log
/dev/raw/raw07 /dev/mapper/vg01-redo02.log
/dev/raw/raw08 /dev/mapper/vg01-redo03.log
/dev/raw/raw09 /dev/mapper/vg01-spfile.dbf
/dev/raw/raw10 /dev/mapper/vg01-system01.dbf
/dev/raw/raw11 /dev/mapper/vg01-temp.dbf
/dev/raw/raw12 /dev/mapper/vg01-undotbs.dbf
/dev/raw/raw13 /dev/mapper/vg01-users.dbf
/dev/raw/raw14 /dev/mapper/vg01-drsys01.dbf
/dev/raw/raw15 /dev/mapper/vg01-tools01.dbf
/dev/raw/raw16 /dev/mapper/vg01-xdb01.dbf
~
~
~
"/etc/sysconfig/rawdevices" 26L, 955C written
7、授权
[root@oel4 mapper]# chown oracle:oninstall /dev/raw/raw2
chown: `oracle:oninstall': invalid group
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw2
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw2
chown -R oracle:oinstall /dev/raw/raw3
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw3
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw4
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw5
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw6
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw7
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw8
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw9
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw10
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw11
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw12
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw13
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw14
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw15
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw16
[root@oel4 mapper]# chown -R oracle:oinstall /dev/raw/raw3
[root@oel4 mapper]# cd /dev/raw/
[root@oel4 raw]# ll
total 0
crw-rw---- 1 oracle oinstall 162, 10 Dec 21 10:15 raw10
crw-rw---- 1 oracle oinstall 162, 11 Dec 21 10:15 raw11
crw-rw---- 1 oracle oinstall 162, 12 Dec 21 10:15 raw12
crw-rw---- 1 oracle oinstall 162, 13 Dec 21 10:15 raw13
crw-rw---- 1 oracle oinstall 162, 14 Dec 21 10:15 raw14
crw-rw---- 1 oracle oinstall 162, 15 Dec 21 10:15 raw15
crw-rw---- 1 oracle oinstall 162, 16 Dec 21 10:15 raw16
crw-rw---- 1 oracle oinstall 162, 2 Dec 21 10:15 raw2
crw-rw---- 1 oracle oinstall 162, 3 Dec 21 10:15 raw3
crw-rw---- 1 oracle oinstall 162, 4 Dec 21 10:15 raw4
crw-rw---- 1 oracle oinstall 162, 5 Dec 21 10:15 raw5
crw-rw---- 1 oracle oinstall 162, 6 Dec 21 10:15 raw6
crw-rw---- 1 oracle oinstall 162, 7 Dec 21 10:15 raw7
crw-rw---- 1 oracle oinstall 162, 8 Dec 21 10:15 raw8
crw-rw---- 1 oracle oinstall 162, 9 Dec 21 10:15 raw9
8、使用raw绑定的裸设备重启机器后失效,添加系统自启动
[[root@localhost ~]# /sbin/chkconfig rawdevices on
删除逻辑卷:
[root@localhost ~]# lvremove /dev/vg_localhost/lv_home
Do you really want to remove active logical volume lv_home? [y/n]: y
Logical volume "lv_home" successfully removed
[root@localhost ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 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: 0x0001506f
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 13055 104344576 8e Linux LVM
Disk /dev/mapper/vg_localhost-lv_root: 50.9 GB, 50939822080 bytes
255 heads, 63 sectors/track, 6193 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: 0x00000000
Disk /dev/mapper/vg_localhost-lv_root doesn't contain a valid partition table
Disk /dev/mapper/vg_localhost-lv_swap: 10.6 GB, 10552868864 bytes
255 heads, 63 sectors/track, 1282 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: 0x00000000
Disk /dev/mapper/vg_localhost-lv_swap doesn't contain a valid partition table
逻辑卷组信息:
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name vg_localhost
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 99.51 GiB
PE Size 4.00 MiB
Total PE 25474
Alloc PE / Size 14661 / 57.27 GiB
Free PE / Size 10813 / 42.24 GiB
VG UUID 5F2Ln2-ZTWk-MFPI-s98y-Ki6I-BXcv-6vhdTg
重新添加逻辑卷:
[root@localhost ~]# lvcreate -L 10G -n data01 vg_localhost
Logical volume "data01" created
[root@localhost ~]# lvcreate -L 10G -n data02 vg_localhost
Logical volume "data02" created
[root@localhost ~]# lvcreate -L 10G -n fra01 vg_localhost
Logical volume "fra01" created
[root@localhost ~]# lvcreate -L 10G -n fra02 vg_localhost
Logical volume "fra02" created
[root@localhost ~]# lvcreate -L 10G -n rman01 vg_localhost
Volume group "vg_localhost" has insufficient free space (573 extents): 2560 required.
[root@localhost ~]# lvcreate -L 573 -n rman01 vg_localhost
Rounding up size to full physical extent 576.00 MiB
Logical volume "rman01" created
[root@localhost mapper]# vi /etc/sysconfig/rawdevices
/dev/raw/raw5 /dev/mapper/vg_localhost-rman01
# raw device bindings
# format:
#
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5
/dev/raw/raw1 /dev/mapper/vg_localhost-data01
/dev/raw/raw2 /dev/mapper/vg_localhost-data02
/dev/raw/raw3 /dev/mapper/vg_localhost-fra01
/dev/raw/raw4 /dev/mapper/vg_localhost-fra02
/dev/raw/raw5 /dev/mapper/vg_localhost-rman01
~
~
[root@localhost mapper]# /etc/init.d/rawdevices start
Assigning devices:
/dev/raw/raw1 --> /dev/mapper/vg_localhost-data01
/dev/raw/raw1: bound to major 253, minor 2
/dev/raw/raw2 --> /dev/mapper/vg_localhost-data02
/dev/raw/raw2: bound to major 253, minor 3
/dev/raw/raw3 --> /dev/mapper/vg_localhost-fra01
/dev/raw/raw3: bound to major 253, minor 4
/dev/raw/raw4 --> /dev/mapper/vg_localhost-fra02
/dev/raw/raw4: bound to major 253, minor 5
/dev/raw/raw5 --> /dev/mapper/vg_localhost-rman01
/dev/raw/raw5: bound to major 253, minor 6
done
以上说明绑定裸设备成功
[root@localhost mapper]# raw -qa
/dev/raw/raw1: bound to major 253, minor 2
/dev/raw/raw2: bound to major 253, minor 3
/dev/raw/raw3: bound to major 253, minor 4
/dev/raw/raw4: bound to major 253, minor 5
/dev/raw/raw5: bound to major 253, minor 6
[root@localhost mapper]# ll /dev/raw/
total 0
crw-r-----. 1 root disk 162, 1 Jun 2 11:38 raw1
crw-r-----. 1 root disk 162, 2 Jun 2 11:38 raw2
crw-r-----. 1 root disk 162, 3 Jun 2 11:38 raw3
crw-r-----. 1 root disk 162, 4 Jun 2 11:38 raw4
crw-r-----. 1 root disk 162, 5 Jun 2 11:38 raw5
crw-rw----. 1 root disk 162, 0 Jun 2 10:51 rawctl
上面的裸设备的属组是root,后面安装GI的时候,修改属组即可。
root@localhost ~]# chmod 660 /dev/raw/raw*
[root@localhost ~]# ll /dev/raw/
total 0
crw-rw----. 1 grid oinstall 162, 1 Jun 2 15:48 raw1
crw-rw----. 1 grid oinstall 162, 2 Jun 2 15:48 raw2
crw-rw----. 1 grid oinstall 162, 3 Jun 2 15:48 raw3
crw-rw----. 1 grid oinstall 162, 4 Jun 2 15:37 raw4
crw-rw----. 1 grid oinstall 162, 5 Jun 2 11:38 raw5
crw-rw----. 1 root disk 162, 0 Jun 2 10:51 rawctl
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28194062/viewspace-1682468/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28194062/viewspace-1682468/