How to create ASM disk on Linux: Easy Step-by-step guide

create ASM disk on Linux

In this article, I will provide a detailed guide on how to create ASM disk on Linux. We’ll walk you through each step of the process with proper screenshots.

1. Before creating the ASM disks, we have to check if the disks have been added and partition created on your machine. If you don’t have created the partition yet then you can follow my article Linux partition creation.

Here we can see disk /dev/sda(local disk) has three local partitions, disk /dev/sdb has one partition /dev/sdb1, disk /dev/sdc has three partitions /dev/sdc1,/dev/sdc2 & /dev/sdc3 and disk /dev/sdd has one partition /dev/sdd1. From the Blocks column, we can find the size of each partition.

[root@node1 ~]# fdisk -l

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x94e57bd6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20971519    10484736   83  Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: A5182436-2B43-4F97-B1A4-A03B862DC141


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic
 3      2508800    209713151   98.8G  Linux LVM

Disk /dev/sdd: 16.1 GB, 16106127360 bytes, 31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x8f77a9f2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048    31457279    15727616   83  Linux

Disk /dev/sdc: 16.1 GB, 16106127360 bytes, 31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xe6e0612d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    10487807     5242880   83  Linux
/dev/sdc2        10487808    20973567     5242880   83  Linux
/dev/sdc3        20973568    31457279     5241856   83  Linux

Disk /dev/mapper/ol-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/ol-swap: 8455 MB, 8455716864 bytes, 16515072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/ol-home: 43.9 GB, 43939528704 bytes, 85819392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Here disk /dev/sdb has only one partition that we will use for OCR and VD. Disk /dev/sdc has three partitions /dev/sdc1,/dev/sdc2 and /dev/sdc3 that we will use for DATA1,DATA2 and DATA3 respectively.Disk /dev/sdd has only one partition of 15GB that we will use for FRA.

2. Now we have to Install and configure Oracle ASM. If you have not configured it yet then go through the article Configure Oracle ASM otherwise you can proceed with the next steps to create ASM disk.

3. First check if any ASM disk present on your system. Here we do not have any ASM disks.

[root@node1 ~]# oracleasm listdisks

OR,

[root@node1 ~]# ls -ltr /dev/oracleasm/disks
total 0

4. Now we are going to create ASM disk on Linux:

[root@node1 ~]# oracleasm createdisk OCRVD /dev/sdb1
Writing disk header: done
Instantiating disk: done

[root@node1 ~]# oracleasm createdisk DATA1 /dev/sdc1
Writing disk header: done
Instantiating disk: done

[root@node1 ~]# oracleasm createdisk DATA2 /dev/sdc2
Writing disk header: done
Instantiating disk: done

[root@node1 ~]# oracleasm createdisk DATA3 /dev/sdc3
Writing disk header: done
Instantiating disk: done

[root@node1 ~]# oracleasm createdisk FRA /dev/sdd1
Writing disk header: done
Instantiating disk: done

5. Run oracleasm scandisks command to scan the system for newly added disks:

[root@node1 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...

6. Now verify if the ASM disks have been created:

[root@node1 ~]# oracleasm listdisks
DATA1
DATA2
DATA3
FRA
OCRVD

OR,

[root@node1 ~]# ls -ltr /dev/oracleasm/disks
total 0
brw-rw---- 1 grid asmadmin 8, 17 Mar  9 19:24 OCRVD
brw-rw---- 1 grid asmadmin 8, 33 Mar  9 19:25 DATA1
brw-rw---- 1 grid asmadmin 8, 34 Mar  9 19:25 DATA2
brw-rw---- 1 grid asmadmin 8, 35 Mar  9 19:25 DATA3
brw-rw---- 1 grid asmadmin 8, 49 Mar  9 19:26 FRA

If you want to check detailed information, run the command lsblk -fm.

How to create ASM disk on Linux: Easy Step-by-step guide

7. If you are using RAC environment then run oracleasm scandisks command on the other nodes to discover the disks. No need to create ASM disk on the other nodes.

[root@node2 ~]# hostname
node2

[root@node2 ~]# oracleasm listdisks

[root@node2 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...

[root@node2 ~]# oracleasm listdisks
DATA1
DATA2
DATA3
FRA
OCRVD

I hope this article made it easier for you to create ASM disk on Linux system on your Virtualbox.

This Post Has 2 Comments

Leave a Reply