前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SUSE Linux 10 配置裸设备(raw devices)

SUSE Linux 10 配置裸设备(raw devices)

作者头像
Leshami
发布2018-08-14 10:53:11
6.2K0
发布2018-08-14 10:53:11
举报
文章被收录于专栏:乐沙弥的世界乐沙弥的世界

     裸设备,是没有经过格式化的分区或磁盘,也叫裸分区(原始分区),不被Unix通过文件系统来读取的特殊字符设备。它由应用程序负责对 它进行读写操作。不经过文件系统的缓冲,是不被操作系统直接管理的设备。由于跨过操作系统管理,使得I/O效率更高。在基于SUSE Linux 10上安装Oracle 10g RAC的话,由于Oracle 10g 不支持将ocr与votingdisk 存放在ASM 磁盘中,因此,依然需要为其使用裸设备方式。SUSE Linux裸设备的配置与其他的Linux稍有差异,下面将具体描述。

代码语言:javascript
复制
1、先对磁盘进行分区,sdd如下面的方法炮制
#下面的示例中使用sdc和sdd来用作裸设备,一块用于ocr,一块用于votingdisk
bo2dbp:~ # fdisk /dev/sdc
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): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 
Value out of range.
Partition number (1-4): 
Value out of range.
Partition number (1-4): 1
First cylinder (1-200, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-200, default 200): 
Using default value 200

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

2、分区后的结果
bo2dbp:~ # fdisk -l /dev/sdc

Disk /dev/sdc: 209 MB, 209715200 bytes
64 heads, 32 sectors/track, 200 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         200      204784   83  Linux
bo2dbp:~ # fdisk -l /dev/sdd

Disk /dev/sdd: 209 MB, 209715200 bytes
64 heads, 32 sectors/track, 200 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         200      204784   83  Linux

3、配置裸设备
bo2dbp:~ # vi /etc/raw

# /etc/raw
#
# sample configuration to bind raw devices
# to block devices
#
# The format of this file is:
# raw<N>:<blockdev>
#
# example:
# ---------
# raw1:hdb1
#
# this means: bind /dev/raw/raw1 to /dev/hdb1
#
# ...

#Add new raw devices
raw1:sdc1
raw2:sdd1

4、启动裸设备
bo2dbp:~ # rcraw start
bind /dev/raw/raw1 to /dev/sdc1...                                    done
bind /dev/raw/raw2 to /dev/sdd1...                                    done

5、配置裸设备随系统启动
bo2dbp:~ # chkconfig raw
raw  on
#修改裸设备的权限与所有者,尽管该操作会修改,但重启之后将失效。永久修改见第7点.检查裸设备是否自动激活: chkconfig --list | grep raw
bo2dbp:~ # chown oracle:dba /dev/raw/raw[1-2]
bo2dbp:~ # chmod 660 /dev/raw/raw[1-2]

6、测试裸设备
bo2dbp:~ # dd if=/dev/zero of=/dev/raw/raw1 bs=1024k count=200
dd: writing `/dev/raw/raw1': No space left on device
200+0 records in
199+0 records out
209698816 bytes (210 MB) copied, 2.59567 seconds, 80.8 MB/s

7、修改裸设备启动后权限及所有者
#使用root用户修改/etc/udev/rules.d/50-udev-default.rules,确保raw设备的权限GROUP="dba", MODE="660", OWNER="oracle"
#将其中包含KENREL=="raw"的记录修改为如下
KERNEL=="raw[0-9]*", SUBSYSTEM=="raw", NAME="raw/%k", GROUP="dba", MODE="660", OWNER="oracle"

8、确认配置成功
#重启之后的状态     #Author :Robinson Cheng  Blog:http://blog.csdn.net/robinson_0612
bo2dbp:~ # ls -hltr /dev/raw
total 0
crw-rw---- 1 root   disk 162, 0 Sep 19 10:22 rawctl
crw-rw---- 1 oracle dba  162, 1 Sep 19 10:22 raw1
crw-rw---- 1 oracle dba  162, 2 Sep 19 10:22 raw2

bo2dbs:~ # /usr/sbin/raw -qa 
/dev/raw/raw1:  bound to major 8, minor 33
/dev/raw/raw2:  bound to major 8, minor 49
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2012年09月19日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
AI 应用产品
文字识别(Optical Character Recognition,OCR)基于腾讯优图实验室的深度学习技术,将图片上的文字内容,智能识别成为可编辑的文本。OCR 支持身份证、名片等卡证类和票据类的印刷体识别,也支持运单等手写体识别,支持提供定制化服务,可以有效地代替人工录入信息。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档