linux下新增裸裝置

哎呀我的天吶發表於2015-03-19
最近在redhat AS 4和 redhat 5上面使用裸裝置建庫,發現者兩者的裸裝置的配置,不一致。記錄一下。

AS 4下:
新增裸裝置:
1、新增原始磁碟
     在虛擬機器磁碟部分新增即可
2、使用fdisk -l檢視磁碟,可以看到一塊未分配的磁碟。
   [root@RHEL4-32-227 ~]# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6527    52323705   8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes


3、fdisk /dev/sdb 分割槽,對於scsi硬碟只能有15個分割槽,IDE可以有63個

4、fdisk -l
  Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          98      787153+  83  Linux
/dev/sdb2              99         172      594405   83  Linux
/dev/sdb3             173         234      498015   83  Linux
/dev/sdb4             235        1305     8602807+   5  Extended
/dev/sdb5             235         296      497983+  83  Linux
/dev/sdb6             297         303       56196   83  Linux
/dev/sdb7             304         310       56196   83  Linux
/dev/sdb8             311         335      200781   83  Linux
/dev/sdb9             336         360      200781   83  Linux
/dev/sdb10            361         385      200781   83  Linux
/dev/sdb11            386         410      200781   83  Linux
/dev/sdb12            411         435      200781   83  Linux
/dev/sdb13            436         460      200781   83  Linux
/dev/sdb14            461         704     1959898+  83  Linux
  
5、vi /etc/sysconfig/rawdevices修改如下:
     加入
    

/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
/dev/raw/raw3 /dev/sdb3
/dev/raw/raw4 /dev/sdb5
/dev/raw/raw5 /dev/sdb6
/dev/raw/raw6 /dev/sdb7
/dev/raw/raw7 /dev/sdb8
/dev/raw/raw8 /dev/sdb9
/dev/raw/raw9 /dev/sdb10
/dev/raw/raw10 /dev/sdb11
/dev/raw/raw11 /dev/sdb12
/dev/raw/raw12 /dev/sdb13
/dev/raw/raw13 /dev/sdb14

6、給與oracle使用者更改裸裝置的許可權:
     chown -R oracle:oinstall  /dev/raw
     chmod -R 660 /dev/raw

7、把使用者許可權在啟動時給使用者
     在etc/rc.local檔案中新增
     chown oracle:oinstall /dev/raw -R
     chmod 660 /dev/raw –R
     chmod a+x /dev/raw
 
刪除裸裝置
#raw /dev/raw/raw1 0 0
#raw /dev/raw/raw2 0 0
 
查詢裸裝置
#raw -qa
 
開啟裸裝置服務
#chkconfig --list |grep raw
#chkconfig --level 2 raw on
#service rawdevices start


[root@RHEL4-32-227 ~]# raw -qa
/dev/raw/raw1:  bound to major 8, minor 17
/dev/raw/raw2:  bound to major 8, minor 18
/dev/raw/raw3:  bound to major 8, minor 19
/dev/raw/raw4:  bound to major 8, minor 21
/dev/raw/raw5:  bound to major 8, minor 22
/dev/raw/raw6:  bound to major 8, minor 23
/dev/raw/raw7:  bound to major 8, minor 24
/dev/raw/raw8:  bound to major 8, minor 25
/dev/raw/raw9:  bound to major 8, minor 26
/dev/raw/raw10: bound to major 8, minor 27
/dev/raw/raw11: bound to major 8, minor 28
/dev/raw/raw12: bound to major 8, minor 29
/dev/raw/raw13: bound to major 8, minor 30



=====================================

redhat 5下面:

只是第五步不同 ;
vim /etc/udev/rules.d/60-raw.rules 
新增如下內容:
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=="sdb3", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sdb8", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", KERNEL=="sdb9", RUN+="/bin/raw /dev/raw/raw8 %N"
ACTION=="add", KERNEL=="sdb10", RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add", KERNEL=="sdb11", RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add", KERNEL=="sdb12", RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add", KERNEL=="sdb13", RUN+="/bin/raw /dev/raw/raw12 %N"
ACTION=="add", KERNEL=="sdb14", RUN+="/bin/raw /dev/raw/raw13 %N"

KERNEL=="raw[1-9]", OWNER="oracle", GROUP="oinstall", MODE="0660"

修改完成 執行 start_udev即可。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-1466326/,如需轉載,請註明出處,否則將追究法律責任。

相關文章