Friday, March 28, 2014

File System On ASM Volume

 (VERSION INFORMATION: Oracle GI & DB11.2.0.3; Red Hat 5u7)

The purpose of the post is to shows how easily you can create and administer filesystem with diskgroup.

Create and Mount Diskgroup
First, we have to create diskgroup. Existing diskgroup can also be used.

SQL> create diskgroup temdg external redundancy disk '/dev/sdk1' name disk12g;
SQL> select inst_id,name,state,compatibility from gv$asm_diskgroup where name ='TEMDG'

Mount the newly created diskgroup on other instances. The newly created diskgroup will only be mounted on the local ASM instance.
$ssh grid@node2   --connect to the other ASM node
SQL> alter diskgroup TEMDG mount;

Create ACFS File System

ASMCMD> volcreate -G temdg -s 1g testacfs
ORA-15032: not all alterations performed
ORA-15221: ASM operation requires compatible.asm of 11.2.0.0.0 or higher (DBD ERROR: OCIStmtExecute)

The above was intentional…this show that you need to advance the compatible.asm to 11.2.

ASMCMD> setattr  -G temdg compatible.asm 11.2
OR
SQL>  ALTER DISKGROUP TEMDG SET ATTRIBUTE 'COMPATIBLE.ASM'='11.2';

We can now successfully run volcreate

ASMCMD>  volcreate -G temdg -s 1g testacfs
OR
SQL> ALTER DISKGROUP TEMDG ADD VOLUME TESTACFS2 SIZE 1G;

Check the volume device name by executing:
ASMCMD> volinfo -G temdg –a                               --(or query V$ASM_VOLUME)




With the device path we can now create filesystem [as root user].
This should be done only on one node!

[root@red1 ~]# mkfs -t acfs /dev/asm/testacfs-225

Let mount the newly created filesystem.
Note: this is cluster filesystem, so you can mount it on other nodes.

[root@red2 ~]# mkdir /testmnt
[root@red2 ~]#  mount -t acfs /dev/asm/testacfs-225 /testmnt


We can also decide to register file system with ACFS mount registry, this will automate mount of the file system.

[root@red2 ~]# acfsutil registry -a /dev/asm/testacfs-225 /testmnt

acfsutil registry: mount point /testmnt successfully added to Oracle Registry

Note: Do not register an Oracle ACFS file system that has had an individual file system Cluster Ready Services (CRS) resource added. For example, do not register a file system with acfsutil registry if the Oracle ACFS file system has been registered using srvctl add filesystem.

Resizing filesystem
Filesystem can also be resized without much work but you must have free space in your DiskGroup.
For example, resizing /testmnt to 6G


#acfsutil size 6G /testmnt

Conclusion:
If ASM infrastructure is configured for RAC DB, you can easily take advantage of the ASM volume to shared files among cluster nodes.

No comments:

Post a Comment