ASMLib is a support library for the Automatic Storage Management feature of the Oracle Database.
Simplifies database administration and reduces kernel resource usage, but some configurations in the OS disks should be done before ASMlib will work as pretended.
This article will explain the configuration of ASMlib disks in GNU/Linux systems in order to ASM can manage them.
Oracle ASM software should be installed and properly configured previously, see note details.
Note
- ASMlib download page:
- http://www.oracle.com/technetwork/server-storage/linux/asmlib/index-101839.html
- ASMlib base configuration:
- http://www.oracle.com/technetwork/server-storage/linux/install-082632.html
We will configure the following system disks to be used by ASMlib:
GNU/Linux Device Name | ASM label |
---|---|
/dev/mapper/asmdisk_01 | ORA_ASM_DISK01 |
/dev/mapper/asmdisk_02 | ORA_ASM_DISK02 |
Creating Partitions (any node)
First of all we will partition the disks:
Using fdisk:
$ for i in 01 02; do echo -e "o\nn\np\n1\n\n\nw" | fdisk /dev/mapper/asmdisk_$i; done
Using parted:
$ for i in 01 02; do parted -s -a optimal /dev/mapper/asmdisk_$i mklabel gpt mkpart primary 0% 100%; done
Check parititons (any node)
Now, check if partitions were created correctly.
Using fdisk:
$ for i in 01 02; do fdisk -l /dev/mapper/asmdisk_$i; done ... Device Boot Start End Blocks Id System /dev/mapper/asmdisk_01p1 1 104433 838858041 83 Linux ... Device Boot Start End Blocks Id System /dev/mapper/asmdisk_02p1 1 26108 209712478+ 83 Linux
Using parted:
$ for i in 01 02; do parted /dev/mapper/asmdisk_$i print; done ... Disk /dev/mapper/asmdisk_01: 85900MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 85.9GB 85.9GB primary ... Disk /dev/mapper/asmdisk_02: 85900MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 85.9GB 85.9GB primary
Load partitons (all nodes)
The partitions must be loaded on all node’s kernel to properly label them with ASMlib.
$ for i in 01 02; do kpartx -a /dev/mapper/asmdisk_$i; done
Check loaded parts (all nodes)
$ for i in 01 02; do kpartx -l /dev/mapper/asmdisk_$i; done asmdisk_01p1 : 0 1677716082 /dev/mapper/asmdisk_01 63 asmdisk_02p1 : 0 419424957 /dev/mapper/asmdisk_02 63
Label ASM disks (any node)
If partitions were loaded correctly in all nodes, we will label the partitions in ASMlib:
$ for i in 01 02; do /etc/init.d/oracleasm createdisk ORA_ASM_DISK${i} /dev/mapper/asmdisk_${i}p1; done Marking disk "ORA_ASM_DISK01" as an ASM disk: [ OK ] Marking disk "ORA_ASM_DISK02" as an ASM disk: [ OK ]
$ oracleasm listdisks ORA_ASM_DISK01 ORA_ASM_DISK02
Scan/List ASM disks (other nodes)
$ oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... Instantiating disk "ORA_ASM_DISK01" Instantiating disk "ORA_ASM_DISK02"
$ oracleasm listdisks ORA_ASM_DISK01 ORA_ASM_DISK02
Conclusion
Hope this short How-To article will be useful to any GNU/Linux SysAdmin and/or DBA using Oracle ASM with ASMlib.