环境说明
操作系统:Oracle Linux 6

  • 下载安装包
http://www.oracle.com/technetwork/server-storage/linux/asmlib/index-101839.html

注意: 所有ASMLib安装都需要oracleasmlib和oracleasm支持包。

  • 安装
[root@vastdata1 oracle]# rpm -ivh oracleasm*
warning: oracleasmlib-2.0.12-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [ 50%]
   2:oracleasmlib           ########################################### [100%]

[root@vastdata1 oracle]# rpm -ivh kmod-oracleasm-2.0.8-4.el6_6.x86_64.rpm --force --nodeps
warning: kmod-oracleasm-2.0.8-4.el6_6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 1d1e034b: NOKEY
Preparing...                ########################################### [100%]
   1:kmod-oracleasm         ########################################### [100%]
  • 检查
[root@vastdata1 oracle]# rpm -qa|grep oracleasm
oracleasmlib-2.0.12-1.el6.x86_64
oracleasm-support-2.1.8-1.el6.x86_64
kmod-oracleasm-2.0.8-4.el6_6.x86_64
  • 查看oracleasm帮助
[root@vastdata1 ~]# /etc/init.d/oracleasm help
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
  • 配置
[root@vastdata1 oracle]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@vastdata1 oracle]# /etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]

查看状态

[root@vastdata1 ~]# /etc/init.d/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
  • 添加磁盘
[root@vastdata1 ~]# ll /dev/sd*
brw-rw---- 1 root disk 8,  0 May 26 19:14 /dev/sda
brw-rw---- 1 root disk 8,  1 May 26 19:14 /dev/sda1
brw-rw---- 1 root disk 8,  2 May 26 19:14 /dev/sda2
brw-rw---- 1 root disk 8,  3 May 26 19:14 /dev/sda3
brw-rw---- 1 root disk 8, 16 May 26 19:14 /dev/sdb
brw-rw---- 1 root disk 8, 32 May 26 19:14 /dev/sdc
  • 将新添加的磁盘进行分区
[root@vastdata1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xac876b7b.
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)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

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-652, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): 
Using default value 652

Command (m for help): p

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0xac876b7b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         652     5237158+  83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@vastdata1 ~]# fdisk /dev/sdc 
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3ecd9031.
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)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): 
Using default value 652

Command (m for help): p

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x3ecd9031

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         652     5237158+  83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
  • 分区查看
[root@vastdata1 ~]# fdisk -l

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0xac876b7b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         652     5237158+  83  Linux

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x000a9425

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26         809     6291456   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             809        6528    45931520   83  Linux

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x3ecd9031

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         652     5237158+  83  Linux
[root@vastdata1 ~]# ll /dev/sd*
brw-rw---- 1 root disk 8,  0 May 26 19:14 /dev/sda
brw-rw---- 1 root disk 8,  1 May 26 19:14 /dev/sda1
brw-rw---- 1 root disk 8,  2 May 26 19:14 /dev/sda2
brw-rw---- 1 root disk 8,  3 May 26 19:14 /dev/sda3
brw-rw---- 1 root disk 8, 16 May 26 19:17 /dev/sdb
brw-rw---- 1 root disk 8, 17 May 26 19:17 /dev/sdb1
brw-rw---- 1 root disk 8, 32 May 26 19:17 /dev/sdc
brw-rw---- 1 root disk 8, 33 May 26 19:17 /dev/sdc1
[root@vastdata1 ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]: 
Default group to own the driver interface [dba]: 
Start Oracle ASM library driver on boot (y/n) [y]: 
Scan for Oracle ASM disks on boot (y/n) [y]: 
Writing Oracle ASM library driver configuration: done
[root@vastdata1 ~]# oracleasm configure
ORACLEASM_ENABLED=true
ORACLEASM_UID=oracle
ORACLEASM_GID=dba
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
  • 创建
[root@vastdata1 ~]# oracleasm createdisk data /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@vastdata1 ~]# oracleasm createdisk fls /dev/sdc1
Writing disk header: done
Instantiating disk: done
  • 检查
[root@vastdata1 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
  • 确认
[root@vastdata1 ~]# oracleasm listdisks
DATA
FLS
[root@vastdata1 ~]# ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 oracle dba 8, 17 May 18 02:37 DATA
brw-rw---- 1 oracle dba 8, 18 May 18 02:37 FLS
[root@vastdata1 bin]# oracleasm querydisk -p data
Disk "DATA" is a valid ASM disk
/dev/sdb1: LABEL="DATA" TYPE="oracleasm" 
[root@vastdata1 bin]# oracleasm querydisk -p fls
Disk "FLS" is a valid ASM disk
/dev/sdc1: LABEL="FLS" TYPE="oracleasm" 
Logo

更多推荐