在Linux上使用raw device方式(2)

二,绑定raw device
[root@localhost oracle]# raw /dev/raw/raw1 /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 18
[root@localhost oracle]# raw /dev/raw/raw2 /dev/sdb2
/dev/raw/raw2: bound to major 8, minor 18
[root@localhost oracle]# raw /dev/raw/raw3 /dev/sdb3
/dev/raw/raw3: bound to major 8, minor 18
[root@localhost oracle]# raw /dev/raw/raw4 /dev/sdb4
/dev/raw/raw4: bound to major 8, minor 18
[root@localhost oracle]#vi /etc/sysconfig/rawdevices
在文件中加入如下内容:
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
/dev/raw/raw3 /dev/sdb4
/dev/raw/raw4 /dev/sdb4
另执行 /etc/init.d/rawdevices restart 使配置文件中的裸设备生效,执行 /sbin/chkconfig rawdevices on 保证机器启动的时候裸设备能够加载。

三,授权
[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw1
[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw2
[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw3
[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw4
另修改配置文件/etc/udev/permissions.d/50-udev.permissions
注释掉raw/*:root:disk:0660,添加新行raw/*:oracle:dba:0660
此时,如绑定raw device,则默认权限为oracle:dba了。
--另如需要可以进行相应链接,
如ln -s /dev/raw/raw1 /u1/oracle/oradata/test10g/test_raw1.dbf,然后可以直接为oracle所用了。


另一种是lvm的方式,测试如下:
一,创建pv
[root@localhost ~]# pvcreate -M2 --metadatasize 100M /dev/sdb7 /dev/sdb8 /dev/sdb9 /dev/sdb10 /dev/sdc
Physical volume "/dev/sdb7" successfully created
Physical volume "/dev/sdb8" successfully created
Physical volume "/dev/sdb9" successfully created
Physical volume "/dev/sdb10" successfully created
Physical volume "/dev/sdc" successfully created
[root@localhost ~]# lvmdiskscan
/dev/ramdisk [ 16.00 MB]
/dev/ram [ 16.00 MB]
/dev/sda1 [ 502.00 MB]
/dev/ram2 [ 16.00 MB]
/dev/root [ 8.50 GB]
/dev/ram3 [ 16.00 MB]
/dev/sda3 [ 2.00 GB]
/dev/ram4 [ 16.00 MB]
/dev/ram5 [ 16.00 MB]
/dev/sda5 [ 1.00 GB]
/dev/ram6 [ 16.00 MB]
/dev/ram7 [ 16.00 MB]
/dev/ram8 [ 16.00 MB]
/dev/ram9 [ 16.00 MB]
/dev/ram10 [ 16.00 MB]
/dev/ram11 [ 16.00 MB]
/dev/ram12 [ 16.00 MB]
/dev/ram13 [ 16.00 MB]
/dev/ram14 [ 16.00 MB]
/dev/ram15 [ 16.00 MB]
/dev/sdb1 [ 980.50 MB]
/dev/sdb2 [ 980.53 MB]
/dev/sdb3 [ 1.92 GB]
/dev/sdb5 [ 509.84 MB]
/dev/sdb6 [ 549.07 MB]
/dev/sdb7 [ 509.84 MB] LVM physical volume
/dev/sdb8 [ 509.84 MB] LVM physical volume
/dev/sdb9 [ 549.07 MB] LVM physical volume
/dev/sdb10 [ 627.51 MB] LVM physical volume
/dev/sdb11 [ 1011.88 MB]
/dev/sdc [ 8.00 GB] LVM physical volume
3 disks
23 partitions
1 LVM physical volume whole disk
4 LVM physical volumes

二,创建vg
[root@localhost ~]# vgcreate vg_db1 /dev/sdc -s 128m
Volume group "vg_db1" successfully created
[root@localhost ~]# vgcreate vg_db2 /dev/sdc -s 128m
Volume group "vg_db2" successfully created

三,创建lv
[root@localhost ~]# lvcreate -L 512m -I 64k vg_db2 -n lv_db2_02
Ignoring stripesize argument with single stripe
Logical volume "lv_db2_02" created
[root@localhost ~]# lvcreate -L 1024m -I 64k vg_db2 -n lv_db2_03
Ignoring stripesize argument with single stripe
Logical volume "lv_db2_03" created
[root@localhost ~]# lvcreate -L 512m -I 64k vg_db2 -n lv_db2_04
Ignoring stripesize argument with single stripe
Logical volume "lv_db2_04" created
[root@localhost ~]# lvcreate -L 2048m -I 64k vg_db2 -n lv_db2_05
Ignoring stripesize argument with single stripe
Logical volume "lv_db2_05" created

四,绑定
[root@localhost ~]# raw /dev/raw/raw1 /dev/mapper/vg_db2-lv_db2_01
/dev/raw/raw4: bound to major 253, minor 5
[root@localhost ~]# raw /dev/raw/raw2 /dev/mapper/vg_db2-lv_db2_02
/dev/raw/raw4: bound to major 253, minor 5
[root@localhost ~]# raw /dev/raw/raw3 /dev/mapper/vg_db2-lv_db2_03
/dev/raw/raw4: bound to major 253, minor 5
[root@localhost ~]# raw /dev/raw/raw4 /dev/mapper/vg_db2-lv_db2_04
/dev/raw/raw4: bound to major 253, minor 5
后面授权等作业和第一种方式类同,上面要注意的是lv的命名方式,命名方式分解如下:
/dev/mapper/+ vgname + '-' + lvname. 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wypyyp.html