This blog is a quick look at ASM in a Linux environment. For the record, I’m using Oracle Enterprise Linux (OEL) 4.8 on a basic kernel with no package or kernel updates. My OEL installation is running in a Virtual Machine.
Item of most interest to me is the installation of the ASM kernel driver because I discovered that Oracle do not include the base release ASM drivers for an OEL release version. For example, you will not find the ASM kernel driver for OEL 4.8 on the Technet website, however you will find the ASM kernel driver contained in the RPM package folder of the CD or DVD iso image; this is discussed in more detail below.
The basic steps I intended to discuss below are
- Split a disk into two partitioned devices; hdc1 and hdc2.
- Install the support and lib packages.
- Download and install ASM lib and ASM support packages.
- Install the ASM Kernel driver from the CD or DVD iso image.
- Configure the ASM disk manager.
- Allocate and label the hdc1 and hdc2 devices for ASM disk management.
Split a disk into two partitioned devices; hdc1 and hdc2.
Partition the hdc disk device into two partitions containing an equal number of disk blocks.
[root@OEL48 ~]# fdisk /dev/hdc
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.
The number of cylinders for this disk is set to 41610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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-41610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-41610, default 41610): 20805
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (20806-41610, default 20806):
Using default value 20806
Last cylinder or +size or +sizeM or +sizeK (20806-41610, default 41610):
Using default value 41610
Command (m for help): p
Disk /dev/hdc: 21.4 GB, 21474836480 bytes
16 heads, 63 sectors/track, 41610 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 20805 10485688+ 83 Linux
/dev/hdc2 20806 41610 10485720 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@OEL48 ~]#
Inform the OS of partition table changes.
partprobe
List the disk devices and partitions just to satisfy our own curiosity.
[root@OEL48 ~]# sfdisk -l
Disk /dev/hda: 20805 cylinders, 16 heads, 63 sectors/track
Warning: The partition table looks like it was made
for C/H/S=*/255/63 (instead of 20805/16/63).
For this listing I'll assume that geometry.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/hda1 * 0+ 12 13- 104391 83 Linux
/dev/hda2 13 1304 1292 10377990 8e Linux LVM
/dev/hda3 0 - 0 0 0 Empty
/dev/hda4 0 - 0 0 0 Empty
Disk /dev/hdc: 41610 cylinders, 16 heads, 63 sectors/track
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/hdc1 0+ 20804 20805- 10485688+ 83 Linux
/dev/hdc2 20805 41609 20805 10485720 83 Linux
/dev/hdc3 0 - 0 0 0 Empty
/dev/hdc4 0 - 0 0 0 Empty
[root@OEL48 ~]#
Download and install ASM lib and ASM support packages
Visit Oracle Linux technology pages, navigate to the downloads section, then ASMlib, then choose your operating system vendor ( Redhat, Suse and so on ). Select the operating system version.
The web address you need is at Oracle
Get the ASM support and lib RPM package appropriate to your Linux vendors and version.
I’m running OEL 4.8 which is an Oracle clone and rebadge of Redat Enterprise Linux 4.8. I don’t have an Oracle support contract so cannot use any of the excellent Oracle up2date or oracleasm kernel driver matching facilities available after the ASM support package is installed.
So, moving on, download the ASM support and ASM lib packages.
wget http://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel4/amd64/2.1.4/oracleasm-support-2.1.4-1.el4.x86_64.rpm
wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el4.x86_64.rpm
Install the support and lib packages
rpm -Uvh oracleasm-support*.rpm \
oracleasmlib-*.rpm
Install the ASM Kernel driver from the CD or DVD iso image
If your kernel has not been updated and is running the Linux distribution base version release, then you can get the ASM Kernel driver from the distribution CD or DVD image. As follows:
As I already mentioned, I’m running OEL 4.8 within a virtual machine, so I attached the OEL 4.8 DVD iso image to the “IDE Controller” which associates the iso with the controller, all that remains is for the DVD to be mounted within the running virtual machine.
Log into the OEL 4.8 machine as root and mount the DVD ISO image and make change the current folder into the DVD.
su - root
password
mount /dev/cdrom
Move to the DVD folder that contains the ASM RPM package.
cd /media/cdrom/Enterprise/RPMS
Confirm to yourself the ASM Kernel driver is on the DVD.
ls oracleasm-`uname -r`*.rpm
Install the ASM kernel driver.
rpm -Uvh oracleasm-`uname -r`*.rpm
Simples, the kernel driver should now be installed.
Lets get a peek at the current ASM version.
oracleasm -V
Configure the ASM disk manager
/etc/init.d/oracleasm configure
Check that enabling, restarting and checking the status functions work.
/etc/init.d/oracleasm enable
/etc/init.d/oracleasm restart
/etc/init.d/oracleasm status
Allocate and label the hdc1 and hdc2 devices for ASM disk management
Scan all the ASM disks.
/etc/init.d/oracleasm scandisks
And list the disks. Of course there aren't any disks yet, but you get the idea.
/etc/init.d/oracleasm listdisks
After all this work, we can now create the two ASM disk discussed above, the first disk will be the DATA disk which will contain the database files, the second disk FRA will be for the database Faster Record Area - the FRA used to stand for flashback recovery area but this was quietly renamed by Oracle during 2010.
/etc/init.d/oracleasm createdisk DATA /dev/hdc1
/etc/init.d/oracleasm createdisk FRA /dev/hdc2
List the disks the ASM lib know about, which should simply be the DATA and FRA.
/etc/init.d/oracleasm listdisks
Another quick check that ASM lib is alive and kicking.
/etc/init.d/oracleasm status