Friday, September 04, 2009

ASM (DVM) & ACFS by command-lines

11gR2 feature... ASM Dynamic Volume Manager (ADVM) and ASM Clustered File System (ACFS), that make me excite, So I spent much time to get idea...

We can create ACFS by using asmca (link). and we can use command-lines(sql*plus, asmcmd) as well.

- Create a volume from an ASM diskgroup

Connect sql*plus with sysasm:
$ sqlplus / as sysasm

Add volume by "alter diskgroup":
SQL> alter diskgroup DISK03 add volume 'asm_vol1' size 5G;

Diskgroup altered.
Check :
SQL> SELECT dg.name AS diskgroup, v.volume_name, v.bytes_read, v.bytes_written FROM V$ASM_DISKGROUP dg, V$ASM_VOLUME_STAT v WHERE dg.group_number = v.group_number;

DISKGROUP VOLUME_NAME BYTES_READ BYTES_WRITTEN
------------------------------ ------------------------------ ---------- -------------
DISK03 ASM_VOL1 0 0

SQL> SELECT dg.name AS diskgroup, v.volume_name, v.volume_device, v.mountpath,v.state FROM V$ASM_DISKGROUP dg, V$ASM_VOLUME v WHERE dg.group_number = v.group_number;

DISKGROUP VOLUME_NAM VOLUME_DEVICE MOUNTPATH STATE
---------- ---------- ------------------------------ ------------------------------ --------
DISK03 ASM_VOL1 /dev/asm/asm_vol1-15 DISABLED
Or... use "asmcmd"
ASMCMD> volcreate -G DISK03 -s 5G asm_vol1

ASMCMD> volstat

DISKGROUP NUMBER / NAME: 3 / DISK03
---------------------------------------
VOLUME_NAME
READS BYTES_READ READ_TIME READ_ERRS
WRITES BYTES_WRITTEN WRITE_TIME WRITE_ERRS
-------------------------------------------------------------
ASM_VOL1
0 0 0 0
0 0 0 0

ASMCMD> volinfo -G DISK03 asm_vol1
Diskgroup Name: DISK03

Volume Name: ASM_VOL1
Volume Device: /dev/asm/asm_vol1-15
State: DISABLED
Size (MB): 5120
Resize Unit (MB): 256
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
- Enable "asm_vol1' volume
SQL> !ls -l /dev/asm/asm_vol1-15
ls: /dev/asm/asm_vol1-15: No such file or directory

SQL> alter diskgroup DISK03 enable volume 'asm_vol1';

Diskgroup altered.

SQL> !ls -l /dev/asm/asm_vol1-15
brwxrwx--- 1 root osasm 252, 7681 Sep 4 11:26 /dev/asm/asm_vol1-15

SQL> SELECT dg.name AS diskgroup, v.volume_name, v.volume_device, v.mountpath,v.state FROM V$ASM_DISKGROUP dg, V$ASM_VOLUME v WHERE dg.group_number = v.group_number;

DISKGROUP VOLUME_NAM VOLUME_DEVICE MOUNTPATH STATE
---------- ---------- ------------------------------ ------------------------------ --------
DISK03 ASM_VOL1 /dev/asm/asm_vol1-15 ENABLED
Or... use "asmcmd"
$ ls -l /dev/asm/asm_vol1-15
ls: /dev/asm/asm_vol1-15: No such file or directory

ASMCMD> volenable -G DISK03 asm_vol1

ASMCMD> volinfo -G DISK03 asm_vol1
Diskgroup Name: DISK03

Volume Name: ASM_VOL1
Volume Device: /dev/asm/asm_vol1-15
State: ENABLED
Size (MB): 5120
Resize Unit (MB): 256
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:

$ ls -l /dev/asm/asm_vol1-15
brwxrwx--- 1 root osasm 252, 7681 Sep 4 11:43 /dev/asm/asm_vol1-15
- Register mount point
$ mkdir -p /oracle/product/acfsmounts/disk03_asm_vol1

$ su - root

# acfsutil registry -a -f /dev/asm/asm_vol1-15 /oracle/product/acfsmounts/disk03_asm_vol1
acfsutil registry: mount point /oracle/product/acfsmounts/disk03_asm_vol1 successfully added to Oracle Registry

# mount.acfs -o all
mount.acfs: ACFS-00591: error found in volume disk header
mount.acfs: ACFS-02037: File system not created on a Linux system. Cannot mount.
found error... so(make acfs)
# mkfs.acfs -f /dev/asm/asm_vol1-15
mkfs.acfs: version = 11.2.0.1.0.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/asm_vol1-15
mkfs.acfs: volume size = 5368709120
mkfs.acfs: Format complete.
And mount:
# mount.acfs -o all
Or mount.acfs /dev/asm/asm_vol1-15 /oracle/product/acfsmounts/disk03_asm_vol1/

Check...
# df
Filesystem 1K-blocks Used Available Use% Mounted on

/dev/asm/asm_vol1-15 5242880 47512 5195368 1% /oracle/product/acfsmounts/disk03_asm_vol1
- Test create file
# cd /oracle/product/acfsmounts/disk03_asm_vol1
# ls -la
drwxr-xr-x 5 root root 4096 Sep 4 11:54 .ACFS

# touch file.txt
# ls file.txt
file.txt
- Check Again
SQL> SELECT dg.name AS diskgroup, v.volume_name, v.volume_device, v.mountpath,v.state FROM V$ASM_DISKGROUP dg, V$ASM_VOLUME v WHERE dg.group_number = v.group_number;

DISKGROUP VOLUME_NAM VOLUME_DEVICE MOUNTPATH STATE
---------- ---------- ------------------------------ ------------------------------------------ --------
DISK03 ASM_VOL1 /dev/asm/asm_vol1-15 /oracle/product/acfsmounts/disk03_asm_vol1 ENABLED

SQL> SELECT dg.name AS diskgroup, v.volume_name, v.bytes_read, v.bytes_written FROM V$ASM_DISKGROUP dg, V$ASM_VOLUME_STAT v WHERE dg.group_number = v.group_number;

DISKGROUP VOLUME_NAM BYTES_READ BYTES_WRITTEN
---------- ---------- ---------- -------------
DISK03 ASM_VOL1 372736 11745280
Or... use"asmcmd"
ASMCMD> volinfo -G DISK03 asm_vol1
Diskgroup Name: DISK03

Volume Name: ASM_VOL1
Volume Device: /dev/asm/asm_vol1-15
State: ENABLED
Size (MB): 5120
Resize Unit (MB): 256
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage: ACFS
Mountpath: /oracle/product/acfsmounts/disk03_asm_vol1

ASMCMD> volstat

DISKGROUP NUMBER / NAME: 3 / DISK03
---------------------------------------
VOLUME_NAME
READS BYTES_READ READ_TIME READ_ERRS
WRITES BYTES_WRITTEN WRITE_TIME WRITE_ERRS
-------------------------------------------------------------
ASM_VOL1
416 372736 6 0
2941 11745280 242 0
that's step to test it... and thank good blog help idea.

No comments: