ASMdisks

From Dirty Cache Wiki
Jump to navigation Jump to search

Intro

ASMdisks provides a way to manage Oracle ASM volumes using Linux UDEV as alternative to Oracle ASMLib.

A deeper explanation here: Fun with Linux UDEV and ASM: Using UDEV to create ASM disk volumes

You can use a combination of entire disks, partitions or mapper (including multipath) devices to configure as block devices for Oracle ASM (or other purposes such as destructive IOPS performance testing).

The asmdisks package provides some scripts of which /usr/bin/asm is the most important. It manages a file named /etc/asmtab with definitions for configuring Linux UDEV devices so you don't have to manually create the udev rules file. It also provides consistent naming based on SCSI serial IDs or device mapper configuration. By default, managed volumes appear as /dev/oracleasm/<volname> with owner "grid" and group "asmdba". In Oracle ASM, point the ASM_DISKSTRING to /dev/oracleasm to make things come to life.

asmdisks can handle raw volumes (i.e. /dev/sdi), partitions (/dev/sdi1) or mapper volumes (/dev/mapper/datavg-vol1) including Linux Multipath devices. ASMdisks now supports DellEMC Powerpath and SCINI (PowerFlex) devices.

Installation

# Install the repository
yum install https://yum.dirty-cache.com/dctools-release.rpm

# List available packages
yum --disablerepo="*" --enablerepo="dctools" list available
# Install the "asmdisks" package:
yum install asmdisks
# If you run VMware, add 
disk.EnableUUID=true
# to the VMX configuration (see [http://gruffdba.wordpress.com/2012/11/06/scsi_id-on-centos-6-on-vmware-returns-null scsi_id on CentOS 6 on VMware returns null])
# and reboot


Because asmdisks is part of the Outrun Extras YUM repository on my web server, you can get updates via "yum update" as soon as I publish a new version of the package. In case this leads to problems, you can do "yum downgrade asmdisks" to go back to the previous release. The source RPM is also available from my web server if you would like to rebuild the package for your own purpose - it's licensed under GPLv3 so you're free to modify it in any way you like. If you make useful improvements I would appreciate to include these in the package (will list your name under authors if you like).

Info and manual

man asm man asmstat less /usr/share/doc/asmdisks/README

ASMdisks usage

If you have asmdisks installed as well as bash-completion, then you can use TAB completion. The "asm" command also responds to -? or -h options for help, or just "asm" without options. There's a man page ("man asm") as well with more detailed usage info.

TAB completion shows available commands and a list of available devices or volumes where you need them.

Showing available disks

# Show disks
asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    -
/dev/sdd         [1:0:1:0]         4G blank    -
/dev/sde         [1:0:2:0]         2G blank    -

Adding disks

# Note that asm only allows creating volumes on either blank disks or with an Oracle ASM signature
asm createdisk data /dev/sdc
Updating asm rules
asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    /dev/oracleasm/data
/dev/sdd         [1:0:1:0]         4G blank    -
/dev/sde         [1:0:2:0]         2G blank    -

Note that TAB completion works [1]: try "asm [TAB][TAB] c [TAB] vol2 [TAB][TAB][TAB] and you will see something like this:

asm createdisk vol02 /dev/
/dev/mapper/rvg-home  /dev/mapper/rvg-swap  /dev/mapper/rvg-var   /dev/sdd              
/dev/mapper/rvg-opt   /dev/mapper/rvg-tmp   /dev/sdb              /dev/sde              
/dev/mapper/rvg-root  /dev/mapper/rvg-usr   /dev/sdc

Adding a few more disks:

asm createdisk temp /dev/sdd
Updating asm rules
asm createdisk redo /dev/sde
Updating asm rules

Listing volumes

asm list
Volume               Device      Type         Size
data                 /dev/sdc    blank        16.0
temp                 /dev/sdd    blank         4.0
redo                 /dev/sde    blank         2.0

Here the volume name is listed, the size, mapper name (not set here so it shows [-]), linux device name.

Showing ASMdisks volumes under Linux

The default diskstring is /dev/oracleasm so the shorthand vol1 and vol2 here actually means /dev/oracleasm/vol1 and ../vol2:

ls -al /dev/oracleasm/
total 0
drwxr-xr-x  2 root root  100 Apr 20 09:32 .
drwxr-xr-x 20 root root 3340 Apr 20 09:30 ..
lrwxrwxrwx  1 root root    6 Apr 20 09:32 data -> ../sdc
lrwxrwxrwx  1 root root    6 Apr 20 09:32 redo -> ../sde
lrwxrwxrwx  1 root root    6 Apr 20 09:32 temp -> ../sdd

Note that asmdisks also changes the owner/group/permissions of the device:

ls -al /dev/sd?
brw-rw---- 1 root disk   8,  0 Apr 20 09:34 /dev/sda
brw-rw---- 1 root disk   8, 16 Apr 20 09:34 /dev/sdb
brw-rw---- 1 grid asmdba 8, 32 Apr 20 09:34 /dev/sdc
brw-rw---- 1 grid asmdba 8, 48 Apr 20 09:34 /dev/sdd
brw-rw---- 1 grid asmdba 8, 64 Apr 20 09:34 /dev/sde

Using other disk strings

What if we want another disk string? Just enter it as a prefix to the volume name:

asm createdisk mypath/vol3 /dev/sdf
Updating asm rules
asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    /dev/oracleasm/data
/dev/sdd         [1:0:1:0]         4G blank    /dev/oracleasm/temp
/dev/sde         [1:0:2:0]         2G blank    /dev/oracleasm/redo
/dev/sdf         [0:0:2:0]         1G blank    /dev/mypath/vol3

Deleting volumes

We can remove volumes from asmdisks. Note that the disk itself does not get deleted and the data on the disk remains unchanged.

asm deletedisk mypath/vol3 
Updating asm rules
asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    /dev/oracleasm/data
/dev/sdd         [1:0:1:0]         4G blank    /dev/oracleasm/temp
/dev/sde         [1:0:2:0]         2G blank    /dev/oracleasm/redo
/dev/sdf         [0:0:2:0]         1G blank    -

Renaming disks

Sometimes you just don't like a certain name for a volume. FYI, Oracle ASM couldn't care less what the linux name is of the device as long as it is accessible under ASM_DISKSTRING. But maybe you like to assign more useful names to asmdisks volumes for administrative reasons.

# List volumes, in this case they have meaningless labels vol1..vol3
asm list
Volume               Device      Type         Size
vol1                 /dev/sdc    blank        16.0
vol2                 /dev/sdd    blank         4.0
vol3                 /dev/sde    blank         2.0

# Rename to more meaningful volumes
asm renamedisk vol1 data
Updating asm rules

asm renamedisk vol2 temp
Updating asm rules

asm renamedisk vol3 redo
Updating asm rules
asm list
Volume               Device      Type         Size
data                 /dev/sdc    blank        16.0
temp                 /dev/sdd    blank         4.0
redo                 /dev/sde    blank         2.0

Note that I recommend to stop Oracle ASM before renaming disks to avoid ASM errors.

Could we move a disk between paths? Sure, let's move mypath/vol3 to oracleasm/vol3:

asm renamedisk data stuff/data
Updating asm rules

asm list
Volume               Device      Type         Size
stuff/data           /dev/sdc    blank        16.0
temp                 /dev/sdd    blank         4.0
redo                 /dev/sde    blank         2.0

ls -al /dev/stuff/
total 0
drwxr-xr-x  2 root root   60 Apr 20 11:16 .
drwxr-xr-x 21 root root 3440 Apr 20 11:16 ..
lrwxrwxrwx  1 root root    6 Apr 20 11:16 data -> ../sdc

Using disk partitions

Some people prefer to use disk partitions instead of whole disks. Make sure your disk partitions are aligned in that case (at 1 MiB here):

parted /dev/sdf mklabel gpt
Information: You may need to update /etc/fstab.

asm disks                                              
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    /dev/oracleasm/data
/dev/sdd         [1:0:1:0]         4G blank    /dev/oracleasm/temp
/dev/sde         [1:0:2:0]         2G blank    /dev/oracleasm/redo
/dev/sdf         [0:0:2:0]         1G gpt      -

asm disks                                              
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    /dev/oracleasm/data
/dev/sdd         [1:0:1:0]         4G blank    /dev/oracleasm/temp
/dev/sde         [1:0:2:0]         2G blank    /dev/oracleasm/redo
/dev/sdf         [0:0:2:0]         1G gpt      -

parted /dev/sdf mkpart primary 1m 100%
Information: You may need to update /etc/fstab.

asm createdisk part1 /dev/sdf1
Updating asm rules

asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    /dev/oracleasm/data
/dev/sdd         [1:0:1:0]         4G blank    /dev/oracleasm/temp
/dev/sde         [1:0:2:0]         2G blank    /dev/oracleasm/redo
/dev/sdf         [0:0:2:0]         1G gpt      -

# Note that asm does not show the volume because it's not a disk (it's a partition!)
# We can show it using 'list':
asm list
Volume               Device      Type         Size
data                 /dev/sdc    blank        16.0
temp                 /dev/sdd    blank         4.0
redo                 /dev/sde    blank         2.0
part1                /dev/sdf1   blank          .9

Using LVM logical volumes as ASM devices

For small test servers you might want to test with multiple ASM volumes mapping to logical volumes in a Linux LVM:

# Create a volume group
vgcreate data /dev/sdg
  Physical volume "/dev/sdg" successfully created.
  Volume group "data" successfully created

# Create a 1GiB volume named vol1 on vg 'data', automatically activate upon boot
lvcreate -Ay -L1G -nvol1 data
  Logical volume "vol1" created.

# List the volumes
lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  vol1 data -wi-a-----   1,00g                                                    
  home rvg  -wi-ao---- 512,00m                                                    
  opt  rvg  -wi-ao---- 512,00m                                                    
  root rvg  -wi-ao----   1,00g                                                    
  swap rvg  -wi-ao----   8,00g                                                    
  tmp  rvg  -wi-ao---- 512,00m                                                    
  usr  rvg  -wi-ao----   2,00g                                                    
  var  rvg  -wi-ao----   2,00g     

ls -al /dev/data/
total 0
drwxr-xr-x  2 root root   60 Apr 20 09:44 .
drwxr-xr-x 22 root root 3500 Apr 20 09:44 ..
lrwxrwxrwx  1 root root    7 Apr 20 09:44 vol1 -> ../dm-7

ls -al /dev/dm-7
brw-rw---- 1 root disk 253, 7 Apr 20 09:44 /dev/dm-7

# Now we can use it as asmdisks volume:
asm createdisk lvol1 /dev/data/vol1
Updating asm rules

asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [1:0:0:0]        16G blank    /dev/oracleasm/data
/dev/sdd         [1:0:1:0]         4G blank    /dev/oracleasm/temp
/dev/sde         [1:0:2:0]         2G blank    /dev/oracleasm/redo
/dev/sdf         [0:0:2:0]         1G gpt      -
/dev/sdg         [0:0:3:0]         4G lvm      -

# Note that sdg shows as type "lvm" as it is now a LVM physical volume
# We can show the volume using 'list'

asm list
Volume               Device      Type         Size
data                 /dev/sdc    blank        16.0
temp                 /dev/sdd    blank         4.0
redo                 /dev/sde    blank         2.0
part1                /dev/sdf1   blank          .9
lvol1                /dev/dm-7   blank         1.0

Multipath volumes

If you have device-mapper-multipath installed and configured, you can use multipathed devices. As multipath is managed by device-mapper the way to work with them is the same: just configure /dev/mapper/mpathX as device name similar to using LVM logical volumes. Output then looks like this:

# Listing disks having device-mapper-multipath aliases
asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      mpathb
/dev/sdc         [0:0:2:0]         1G gpt      mpathg
/dev/sdd         [0:0:3:0]         4G lvm      mpathe
/dev/sde         [0:0:5:0]         4G blank    mpathc
/dev/sdf         [0:0:6:0]         2G blank    mpathd
/dev/sdg         [1:0:0:0]        16G blank    mpatha
/dev/sdh         [2:0:0:0]        16G blank    mpatha

# Create a multipathed volume

asm createdisk m1 /dev/mapper/mpatha 
Updating asm rules

# 'disks' still shows the individual paths, not the udev volume
asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        16G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      mpathb
/dev/sdc         [0:0:2:0]         1G gpt      mpathg
/dev/sdd         [0:0:3:0]         4G lvm      mpathe
/dev/sde         [0:0:5:0]         4G blank    mpathc
/dev/sdf         [0:0:6:0]         2G blank    mpathd
/dev/sdg         [1:0:0:0]        16G blank    mpatha
/dev/sdh         [2:0:0:0]        16G blank    mpatha

# Show the volume with 'list'
asm list
Volume               Device      Type         Size
m1                   /dev/dm-3   blank        16.0

Supported disk (driver) types

EMC Powerpath

EMC Powerpath is an excellent alternative for standard multipathing. Powerpath devices work like multipathed devices. Use names like /dev/emcpowera, /dev/emcpowerb and so on.

ScaleIO SCINI devices

DellEMC ScaleIO is a software defined storage layer using a driver named scini. ASMdisks supports SCINI block volumes once they are created using the ScaleIO client (sdc) software.

ASMTab file

We keep track of volume definitions in a file called /etc/asmtab. Let's see what the file looks like:

# /etc/asmtab - configuration file for asmdisks
# Definitions for IORate testing - volumes under /dev/iorate will have root:iops @ mode 0601
PATH=iorate:root:iops:0660
# PATH=oracleasm:oracle:oinstall:0660
#
# This file keeps track of udev disk mappings for asmdisk(1)
# You should normally not have to edit this file directly
# Use asm(1) instead.
#
# On each line:
#
# label type identifier
# where
# label: diskstring/volume name (default diskstring is oracleasm and can be omitted)
# type:  one of scsi, part or mapper (scsi=entire SCSI disk, part=scsi disk partition, mapper=linux disk mapper device)
# label: scsi_id, scsi_id:partition, mapper_name
#
# Ownerships and permissions can be specified for a diskstring:
# PATH=diskstring:owner:group:mode
# default is oracleasm:grid:asmdba:0660
#
# example:
# vol1 scsi 36000c29f825cd85b5fcc70a1aadebf0c   # entire SCSI disk
# vol2 part 36000c298afa5c31b47fe76cbd1750937:1 # partition 1 of entire SCSI disk
# vol3 mapper mpathb                            # /dev/mapper/mpathb (multipath device)
# iorate/test1 mapper iops-vol1                 # LV vol1 on VG iops, will be mapped as /dev/iorate/test1
# -----------------------------------------------
vol2 scsi 36000c297ed46c64ae28ba422880902ca
mypath/vol3 scsi 36000c29df4ec0cef21cfcc31108708a5
vol4 scsi 36000c29997d99a762b3890fc6438cfd1:1
vol6 mapper asmdata-vol6
vol7 mapper asmdata-vol7
vol8 mapper asmdata-vol8
vol1 scsi 36000c2927d96084fab336839b9b7ca68

You see two types of entries in this file: the first is the PATH definition. Default is oracleasm:grid:asmdba:0660 if not specified differently. A definition that comes pre-set in the asmtab file is iorate:iops:0660 which helps us doing raw I/O testing on devices using another excellent EMC tool named <a title="IOrate on Google code" href="https://sites.google.com/site/vwiorate/home" target="_blank">IORate</a>. (using asmdisks this prevents us from running iorate as root and thereby risking overwriting real data).

Updating udev definitions

If you manually changed asmtab you need to re-generate the udev rules. This is done via the "asm scandisks" command. In some cases Linux udev might leave old volume definitions behind, a reboot or manual removal (i.e. rm -f /dev/oracleasm/*) might be required (followed by another run of "asm scandisks" or manual udev commands.

# Manually force the system to re-read and activate the UDEV rules
udevadm control --reload-rules
udevadm trigger

Changing default user, group and modes

Some environments like to use different owners and groups than grid:asmdba. If you want to change this, say, to oracle:asmdba, you can enter this in the PATH= definition. The mode may also be changed if you so like (not recommended if you use ASM).

Example:

# We want to change the default grid:asmdba to, for example, oracle:dba
# So we add a line in /etc/asmtab:
PATH=oracleasm:oracle:dba:0660

# Now the ownership has changed:
ls -al /dev/oracleasm/
total 0
drwxr-xr-x  2 root root   60 Apr 20 10:47 .
drwxr-xr-x 21 root root 3640 Apr 20 10:47 ..
lrwxrwxrwx  1 root root    7 Apr 20 10:55 m1 -> ../dm-3

ls -al /dev/dm-3
brw-rw---- 1 oracle dba 253, 3 Apr 20 10:55 /dev/dm-3

# We also want to change the location of the disks to /dev/asm/, so we change the prefix:
PATH=asm:oracle:dba:0660

# We now also need to change the volume names as the default prefix is 'oracleasm':
asm list
Volume               Device      Type         Size
m1                   /dev/dm-3   blank        16.0

asm renamedisk m1 asm/m1
Updating asm rules

asm list
Volume               Device      Type         Size
asm/m1               /dev/dm-3   blank        16.0

ls -al /dev/asm/m1 
lrwxrwxrwx 1 root root 7 Apr 20 10:58 /dev/asm/m1 -> ../dm-3

Database cloning

If you're familiar with VMware and/or DellEMC technology, you are probably very familiar with the concept of database cloning. You can use these technologies to quickly create a cloned set of volumes, mount these on another host and bring it up as another database, use it for backups, or whatever you like.

In VMware (and usually also using disk arrays) this means that asm disks will get different scsi_id signatures. As "asmdisks" uses these signatures for persistent naming, a cloned set of disks will not be recognised. If the original devices were used by Oracle ASM, the volumes themselves will have ASM signatures written to them so in the case of ASM, we can import the volumes using the "asm import" function. The volumes will get the standard names vol01, vol02, ... etc because ASM does not care what the devs are named anyway and you're free to rename them yourself afterwards.

As illustration I removed all entries from asmtab and rebooted my host:

# Showing available disks
asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        40G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [0:0:2:0]        16G asm      -
/dev/sdd         [0:0:4:0]        32G blank    -
/dev/sde         [1:0:0:0]         8G asm      -
/dev/sdf         [1:0:1:0]         4G asm      -
/dev/sdg         [1:0:2:0]         1G asm      -
/dev/sdh         [2:0:0:0]        64G asm      -
/dev/sdi         [2:0:1:0]        16G blank    -
/dev/sdj         [2:0:2:0]        16G asm      -
/dev/sdk         [2:0:3:0]        16G asm      -
/dev/sdl         [2:0:4:0]         4G gpt      -
/dev/sdm         [2:0:5:0]         1G gpt      -
/dev/sdn         [2:0:6:0]         1G blank    -
/dev/sdo         [2:0:8:0]         1G blank    -
/dev/sdp         [2:0:9:0]         1G blank    -
/dev/sdq        [2:0:11:0]        16G blank    -

# You see asmdisks recognizes ASM signatures but does not know where to configure the volumes 
# so on the "cloned" host ASM cannot see those volumes. Let's import the volumes:

asm import
asm: [msg] importing /dev/sdc as /dev/oracleasm/vol01
Updating asm rules
asm: [msg] importing /dev/sde as /dev/oracleasm/vol02
Updating asm rules
asm: [msg] importing /dev/sdf as /dev/oracleasm/vol03
Updating asm rules
asm: [msg] importing /dev/sdg as /dev/oracleasm/vol04
Updating asm rules
asm: [msg] importing /dev/sdh as /dev/oracleasm/vol05
Updating asm rules
asm: [msg] importing /dev/sdj as /dev/oracleasm/vol06
Updating asm rules
asm: [msg] importing /dev/sdk as /dev/oracleasm/vol07
Updating asm rules

asm disks
Device                SCSI       Size Type     Target
/dev/sda         [0:0:0:0]        40G dos      -
/dev/sdb         [0:0:1:0]        20G gpt      -
/dev/sdc         [0:0:2:0]        16G asm      /dev/oracleasm/vol01
/dev/sdd         [0:0:4:0]        32G blank    -
/dev/sde         [1:0:0:0]         8G asm      /dev/oracleasm/vol02
/dev/sdf         [1:0:1:0]         4G asm      /dev/oracleasm/vol03
/dev/sdg         [1:0:2:0]         1G asm      /dev/oracleasm/vol04
/dev/sdh         [2:0:0:0]        64G asm      /dev/oracleasm/vol05
/dev/sdi         [2:0:1:0]        16G blank    -
/dev/sdj         [2:0:2:0]        16G asm      /dev/oracleasm/vol06
/dev/sdk         [2:0:3:0]        16G asm      /dev/oracleasm/vol07
/dev/sdl         [2:0:4:0]         4G gpt      -
/dev/sdm         [2:0:5:0]         1G gpt      -
/dev/sdn         [2:0:6:0]         1G blank    -
/dev/sdo         [2:0:8:0]         1G blank    -
/dev/sdp         [2:0:9:0]         1G blank    -
/dev/sdq        [2:0:11:0]        16G blank    -

# All disks that had "asm" signatures are now imported.
# They are given volXX names - feel free to rename them to more meaningful names later.

# Remark that "import" only works for full disks, not partitions or logical volumes.

# Let's see in Oracle ASM what it looks like:
# Starting a SQLPlus session as sysasm

SYS:+ASM > @ls-disks

DG		     Name	  Size	       Used	    Free Used % Type	  STATE    Path
------------ ------------ ------------ ------------ ------------ ------ --------- -------- ------------------------------
-			-	 16.00	       0.00	    0.00	MEMBER	  NORMAL   /dev/oracleasm/vol01
-			-	  8.00	       0.00	    0.00	MEMBER	  NORMAL   /dev/oracleasm/vol02
-			-	  4.00	       0.00	    0.00	MEMBER	  NORMAL   /dev/oracleasm/vol03
-			-	  1.00	       0.00	    0.00	MEMBER	  NORMAL   /dev/oracleasm/vol04
-			-	 64.00	       0.00	    0.00	MEMBER	  NORMAL   /dev/oracleasm/vol05
-			-	 16.00	       0.00	    0.00	MEMBER	  NORMAL   /dev/oracleasm/vol06
-			-	 16.00	       0.00	    0.00	MEMBER	  NORMAL   /dev/oracleasm/vol07
			  ------------ ------------ ------------
Total GiB			125.00	       0.00	    0.00

7 rows selected.
@ls-diskgroups 

NAME                 S   M       Size       Free       Used Used %
-------------------- -- -- ---------- ---------- ---------- ------
DATA                 N           0.00       0.00       0.00
FRA                  N           0.00       0.00       0.00
IOPS                 N           0.00       0.00       0.00
REDO                 N           0.00       0.00       0.00
SOE                  N           0.00       0.00       0.00
TEMP                 N           0.00       0.00       0.00
                           ---------- ---------- ----------
Total GiB                        0.00       0.00       0.00

6 rows selected.

SYS:+ASM > alter diskgroup all mount;
SYS:+ASM > @ls-diskgroups 

NAME                 S   M       Size       Free       Used Used %
-------------------- -- -- ---------- ---------- ---------- ------
DATA                 Y   1       8.00       4.23       3.77   47.2
FRA                  Y   1      16.00      15.88       0.13   00.8
IOPS                 Y   1      32.00      29.84       2.16   06.8
REDO                 Y   1       1.00       0.31       0.69   68.8
SOE                  Y   1      64.00       3.86      60.14   94.0
TEMP                 Y   1       4.00       0.80       3.20   80.1
                           ---------- ---------- ----------
Total GiB                      125.00      54.91      70.09

6 rows selected.

Note that a restart of ASM/clusterware would usually also mount all diskgroups (preventing you to do this manually).

ASMstat

Ever used "iostat" under Linux and had issues figuring out which Linux device was mapped to what ASM device?

Because we know what's mapped here we can do some translation. "asmstat" is a small wrapper for "iostat" that filters out some irrelevant disks (like cdrom) and translates /dev/sdXX names into /dev/oracleasm/XXX names. All parameters that you give "asmstat" are forwarded to "iostat" without further modification.

Example:

iostat 
Linux 2.6.32-504.el6.x86_64 (db01)     07-11-14     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3,30    0,00    2,67    1,05    0,00   92,98

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               6,13       303,14        15,49     460918      23546
sdb               1,44         9,82         2,30      14931       3496
sdc               1,92        13,76         2,28      20928       3472
[snip]
dm-7              1,37         1,78         1,70       2710       2580
dm-8              0,40         1,40         0,09       2124        140
dm-9              4,23       221,55        13,22     336874      20096

asmstat -xm 2
Linux 2.6.32-504.el6.x86_64 (db01)     07-11-14     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3,28    0,00    2,65    1,01    0,00   93,06

Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await  svctm  %util
sda                  2,40     1,42    4,62    1,26     0,14     0,01    51,76     0,01    1,38   0,73   0,43
vol01                0,07     0,00    1,11    0,29     0,00     0,00     8,39     0,01    5,04   5,01   0,70
vol02                0,08     0,00    1,56    0,29     0,01     0,00     8,35     0,01    4,05   4,03   0,75
vol03                0,06     0,00    0,91    0,29     0,00     0,00     8,42     0,01    5,59   5,57   0,67
sde                  0,05     0,00    0,99    0,00     0,00     0,00     8,36     0,01   14,06  13,62   1,35
vol04                0,10     0,00    1,33    0,00     0,01     0,00     8,58     0,00    1,47   1,44   0,19
sdg                  0,01     0,00    0,78    0,00     0,00     0,00     8,06     0,00    2,66   1,70   0,13
sdi                  0,05     0,00    0,58    0,00     0,00     0,00     8,74     0,00    2,00   1,95   0,11
sdh                  0,01     0,00    0,48    0,00     0,00     0,00     8,11     0,00    3,26   2,58   0,12
sdl                  0,07     0,00    0,58    0,00     0,00     0,00     8,98     0,00    1,95   1,91   0,11
sdj                  0,05     0,00    0,49    0,00     0,00     0,00     8,77     0,00    2,63   2,57   0,13
sdm                  0,05     0,00    0,58    0,00     0,00     0,00     8,75     0,00    1,86   1,80   0,10
sdn                  0,05     0,00    0,59    0,00     0,00     0,00     8,73     0,00    0,53   0,53   0,03
sdk                  0,04     0,00    0,50    0,00     0,00     0,00     8,70     0,00    2,16   2,16   0,11

Wipedisk

Wipedisk is another small script in the asmdisks package. It backs up the first 1MiB of a block device to /tmp/ and then zeroes it out. Very handy to clear old ASM disks or even a boot disk for re-install of the OS. Because this is potentially a dangerous command (even with the data backed up before clearing) it requires the "-f" flag to become effective and there's a 5 second countdown in which you may still abort.

# wipedisk -f /dev/sdn
Backing up 1st MB of /dev/sdn in /tmp/_dev_sdn, restore with dd if=/tmp/_dev_sdn of=/dev//dev/sdn bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) copied, 0,0128343 s, 81,7 MB/s
Wiping 1st mb of disk /dev/sdn
5
4
3
2
1
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) copied, 0,0854113 s, 12,3 MB/s

Read the wipedisk(1) man page for more info.

  1. Requires the "bash-completion" package to be installed