Setting Up Disks for Oracle ASM and Installing Oracle and Grid Infrastructure on /u01

In this guide, I’ll walk you through how I prepared disks for an Oracle environment, where sda was allocated for ASM (Automatic Storage Management) to store data, and sdb was configured for the /u01 directory, housing the Oracle and Grid binaries. The goal is to ensure optimal performance and reliability by isolating data storage from application binaries.

Environment Summary:

  • sda (6 TB): Dedicated entirely to ASM for Oracle data.
  • sdb (278 GB): Configured to host the /u01 directory for Oracle and Grid binaries. It was initially partitioned by the OS but adjusted to create a new volume specifically for /u01.

Step 1: Preparing sda for ASM Storage

The 6 TB sda disk was allocated specifically for ASM. ASM provides Oracle with efficient data management and balancing, ideal for high-performance environments.

Steps Taken:

  1. View Disks and Partitions:
    To start, I checked the current disk layout to confirm the sda disk was ready for ASM configuration and to identify existing partitions on sdb. Using the lsblk command provided a clear overview of each disk and its partitions.
    Next, I used parted to remove any existing partitions on sda, ensuring it was fully available for Oracle ASM setup:
   lsblk
   # Enter parted interface to clear any existing partitions on /dev/sda
   parted /dev/sda
   (parted) rm 1  # Remove partition (if any)
  1. Initialize Physical Volume and Create Volume Group:
    I initialized sda as a physical volume and then created a volume group called vg_data to organize ASM-related storage.
   pvcreate /dev/sda
   vgcreate vg_data /dev/sda
  1. Create Logical Volumes:
    I divided sda into logical volumes to allocate space for the ASM setup, reserving the remaining space for the last logical volume.
   lvcreate -L 2T -n lv_data1 vg_data
   lvcreate -L 2T -n lv_data2 vg_data
   lvcreate -L 2T -n lv_data3 vg_data
   lvcreate -l 100%FREE -n lv_data4 vg_data  # Allocates all remaining free space

Here, lv_data4 is created using -l 100%FREE to consume the remaining unallocated space on sda, ensuring we utilize the full capacity.

  1. Verify the Configuration:
    Once the logical volumes were created, I used lsblk, lvdisplay, and vgdisplay to confirm the setup:
   lsblk
   lvdisplay
   vgdisplay

Step 2: Configuring sdb for the /u01 Directory

The sdb disk, with 278 GB, was used for the /u01 directory, storing the Oracle and Grid binaries. Separating u01 from ASM storage improves performance and reliability by keeping the binaries and storage management on separate physical drives.

Steps Taken:

  1. Create Logical Volume for /u01:
    I created a logical volume called u01 with 150 GB, ensuring sufficient space for Oracle and Grid infrastructure binaries.
   lvcreate -n u01 -L 150G ol
  1. Format the Logical Volume:
    Using the ext4 filesystem, I formatted the newly created u01 logical volume.
   mkfs.ext4 /dev/ol/u01
  1. Mount and Configure for Persistent Mounting:
    I created the /u01 directory and mounted the volume. To make the mounting persistent across reboots, I added it to /etc/fstab.
   mkdir /u01
   echo '/dev/ol/u01 /u01 ext4 defaults 0 0' >> /etc/fstab
   mount -a
  1. Final Check:
    After mounting, I confirmed the configuration with the following commands:
   df -hTP
   lsblk

Final Configuration Overview

After the setup, here is the disk layout for ASM and the /u01 directory:

lsblk
NAME               MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb                  8:16   0 278.9G  0 disk 
├─sdb2               8:18   0 277.9G  0 part 
│ ├─ol-swap        252:1    0    16G  0 lvm  [SWAP]
│ ├─ol-home        252:2    0    20G  0 lvm  /home
│ ├─ol-root        252:0    0    50G  0 lvm  /
│ └─ol-u01         252:3    0   150G  0 lvm  /u01
└─sdb1               8:17   0     1G  0 part /boot
sr0                 11:0    1  1024M  0 rom  
sda                  8:0    0   6.6T  0 disk 
├─vg_data-lv_data3 252:6    0     2T  0 lvm  
├─vg_data-lv_data1 252:4    0     2T  0 lvm  
├─vg_data-lv_data4 252:7    0 560.5G  0 lvm  
└─vg_data-lv_data2 252:5    0     2T  0 lvm  

Conclusion

This setup isolates Oracle ASM storage from the /u01 directory, which holds the Oracle and Grid binaries, improving both reliability and performance. By using separate physical disks for ASM and application binaries, this configuration is robust, ready to support demanding Oracle workloads with efficiency.

P.S. To allocate the logical volume for ASM, identify the exact path to the logical volume using lvdisplay or by specifying the volume group name, like so:

lvdisplay /dev/vg_data

This will provide the path needed to create an ASM disk. For example, after confirming the path, create the ASM disk with the following command:

oracleasm createdisk DATA04 /dev/vg_data/lv_data4

This ensures the logical volume is correctly allocated for ASM, ready for use in Oracle storage management.

Leave a Reply

Your email address will not be published. Required fields are marked *