blog menu1

KFED KFOD AMDU - ASM Utilities

KFED KFOD AMDU - ASM Utilities


1. KFOD - Kernel Files Osm Disk


KFOD utility is used to simulate the disk discovery from the operating system level and it can be found in $GRID_HOME/bin directory (or ASM_HOME/bin in older releases).
Note: 

1) KFOD is used at installation time as well (by OUI,DBCA or ASMCA) in order to perform disk discovery. 

2) In case of a failed installation (e.g no $GRID_HOME/bin existing yet) KFOD can be found under your stage folder: <stage_folder>/grid/stage/ext/bin/

In such cases you might need to set LD_LIBRARY_PATH to <stage_folder>/grid/stage/ext/lib.

Help screen can be seen using:

$> kfod help=y
_asm_a/llow_only_raw_disks KFOD allow only raw devices [_asm_allow_only_raw_disks=TRUE/(FALSE)]
_asm_l/ibraries ASM Libraries[_asm_libraries='lib1','lib2',...]
_asms/id ASM Instance[_asmsid=sid]
a/sm_diskstring ASM Diskstring [asm_diskstring='discoverystring', 'discoverystring' ...]
d/isks Disks to discover [disks=raw,asm,all]
g/roup Group discover [group=controlfile]
n/ohdr KFOD header suppression [nohdr=TRUE/(FALSE)]
o/p KFOD options type [OP=DISKS/GROUPS/ALL]
p/file ASM parameter file [pfile='parameterfile']
s/tatus Include disk header status [status=TRUE/(FALSE)]
v/erbose KFOD verbose errors [verbose=TRUE/(FALSE)]

The usual syntax used for disk discovery is:
kfod status=TRUE asm_diskstring='<your_path_to_ASM_devices>' disk=ALL

EXAMPLE
$ export LD_LIBRARY_PATH=/u01/stage/11.2.0.1/grid/stage/ext/lib
$ /u01/stage/11.2.0.1/grid/stage/ext/bin/kfod status=TRUE asm_diskstring='/dev/rdsk/*' disk=all dscvgroup=TRUE


Disk Size Header Path Disk Group User Group
====================================================================

1: 10040 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBB0005d0s1 DG oracle oinstall
2: 10040 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBC0006d0s1 DG oracle oinstall
3: 10142 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBE0007d0s1 DG oracle oinstall
4: 10142 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FBF0008d0s1 DG oracle oinstall
5: 9734 Mb MEMBER /dev/rdsk/c0t600144F0E08ACF0000004C2F6FC00009d0s1 FRA oracle oinstall





2. KFED - Kernel Files metadata EDitor


KFED is a useful tool which allows to analyze ASM disk header information when ASM diskgroups can not be mounted.
NOTE:

KFED executable comes with installation from 11.1 onwards; for the older version you must build it.
But it is not included the source of the software, therefore it is not available until GI installation completes. 
If you need to use it before GI being installed, please refer

Note 1505005.1 - Where to find kfed utility before Oracle Grid Infrastructure is installed

Help screen can be seen using:

$>kfed help=y
as/mlib ASM Library [asmlib='lib']
aun/um AU number to examine or update [AUNUM=number]
aus/z Allocation Unit size in bytes [AUSZ=number]
blkn/um Block number to examine or update [BLKNUM=number]
blks/z Metadata block size in bytes [BLKSZ=number]
ch/ksum Update checksum before each write [CHKSUM=YES/NO]
cn/t Count of AUs to process [CNT=number]
de/v ASM device to examine or update [DEV=string]
dm/pall Don't suppress repeated lines when dumping corrupt blocks [DMPALL=YES/NO]
o/p KFED operation type [OP=READ/WRITE/MERGE/REPAIR/NEW/FORM/FIND/STRUCT]
p/rovnm Name for provisioning purposes [PROVNM=string]
s/eek AU number to seek to [SEEK=number]
te/xt File name for translated block text [TEXT=string]
ty/pe ASM metadata block type number [TYPE=number]

The usual syntax used for reading ASM disk header is:
$> kfed read <your_device>

EXAMPLE:

$> kfed read /dev/raw/raw1
kfbh.endian: 1 ; 0x000: 0x01
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check: 2932902794 ; 0x00c: 0xaed08b8a
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000
kfdhdb.compat: 168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum: 0 ; 0x024: 0x0000
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: ASM01_0000 ; 0x028: length=10
kfdhdb.grpname: ASM01 ; 0x048: length=5
kfdhdb.fgname: ASM01_0000 ; 0x068: length=10
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32837774 ; 0x0a8: HOUR=0xe DAYS=0x4 MNTH=0x4 YEAR=0x7d4
kfdhdb.crestmp.lo: 1555722240 ; 0x0ac: USEC=0x0 MSEC=0x29c SECS=0xb MINS=0x17
kfdhdb.mntstmp.hi: 32837774 ; 0x0b0: HOUR=0xe DAYS=0x4 MNTH=0x4 YEAR=0x7d4
kfdhdb.mntstmp.lo: 1563864064 ; 0x0b4: USEC=0x0 MSEC=0x1ab SECS=0x13 MINS=0x17
...
kfdhdb.ub4spare[60]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000

NOTES:
1) KFED returns a readable output only when devices are/were part of an ASM diskgroup.

Otherwise (if the device hasn't been added to a diskgroup yet or the disk is not valid anymore) the output looks like:
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]
2) In case of a non-default AU size, you should specify it in the command:
$> kfed read <your_device> AUSZ=<au_size>

KFED - 



kfed can be used to read and write ASM metadata. In particular disk headers and ASM (hidden) metadata files.
note: kfed in write mode is a powerful but potentially dangerous tool 

# displays online help for the utility
$ kfed -help 

# reads the disk header to stdout
$ kfed op=read dev=/dev/emcpowera1 

# reads the specified AU and block into file /tmp/test
$ kfed op=read dev=/dev/emcpowera1 aunum=3 blknum=3 text=/tmp/test 

# writes from /tmp/test into the specified AU and block 
#block checksum is computed and written together with data
$ kfed op=write dev=/dev/emcpowera1 aunum=3 blknum=3 text=/tmp/test 



3. AMDU - ASM Metadata Dump Utility


AMDU is an utility to extract all the available metadata from one or more ASM disks and/or generate formatted printouts of individual blocks.The utility does not require that any diskgroup to be mounted.
Oracle Support may ask you to provide AMDU output, especially when facing internal errors related to the ASM metadata
NOTE:

AMDU executable comes with installation from 11.1 onwards. Although this tool was released with 11g, it can be used with ASM 10g as well.
Note 553639.1 - Placeholder for AMDU binaries and using with ASM 10g

The usual syntax used for dumping metadata related to a diskgroup is:

$> amdu -diskstring '<your_path_to_ASM_disks' -dump '<diskgroup>'

NOTE:
Every time AMDU is executed a directory is created on the current location, unless it is override by parameter -directory. 

The directory will have the format amdu_YYYY_MM_DD_HH24_MM_SS
The default command will generate following files:

<diskgroup>_0001.img - a exact dump of the content of the diskgroup ;size is limited to 2gb but can be more than one file
<diskgroup>.map - can be used to find the exact location of the ASM metadata on the disks
report.txt - include details about the disks scanned

The report.txt file shows the header info of the disks belonging to diskgroup, like below:
EXAMPLE:


$> amdu -diskstring '/dev/raw/raw*' -dump 'DG11'



<report.txt content>
----------------------------- DISK REPORT N0003 ---------------------------
Disk Path: /dev/raw/raw3
Physical Sector Size: 512 bytes
Disk Size: 977 megabytes
Group Name: DG11
Disk Name: DG11_0000
Failure Group Name: DG11_0000
----------------------------- DISK REPORT N0004 ---------------------------
Disk Path: /dev/raw/raw4
Physical Sector Size: 512 bytes
Disk Size: 978 megabytes
Group Name: DG11
Disk Name: DG11_0001
Failure Group Name: DG11_0001
....

CAUTION: DO NOT USE the above tools with options which can damage your disks, without Oracle Support guidance.

AMDU - 

Allows to dump ASM contents without opening diskgroups, allows to check ASM file mirroring when using normal redundancy
powerful tool for troubleshooting, introduced in 11g, usable in 10g too.
amdu run creates a directory with a report.tx file and the .map (and .img dump files (for metadata nad data, output dependson switches in the commandline )
a few examples of interest: 

# displays online help for the utility
$ amdu -help 

# extracts file 111 from ASM diskgroup TEST4_DATADG1 
# Note: works as asmcmd cp but olso on dismounted disk groups!
$ amdu -dis '/dev/emcpowera1' -extract TEST4_DATADG1.111 

# compares primary and mirror extents in normal redundancy disk groups 
# Useful to check for potential corruption issues 
# results in the report.txt file
$ amdu -dis '/dev/emcpowera1' -compare -extract TEST4_DATADG1.111 -noextract 

# dump contents of a given diskgroup and does not create image file
# the .map file reports on all files found (column number 5 prefixed by the letter F)
$ amdu -dis '/dev/emcpowera1' -noimage -dump TEST4_DATADG1

# print 10 blocks for the first extent of file 111
$ amdu -dis '/dev/emcpowera1' -print TEST4_DATADG1.F111.X1.B1.C10

No comments:

Post a Comment