"Writing disk header: failed" - error while running "oracleasm renamedisk"
Unable to rename or delete the ASM disk. This disk is on multipath introduced to 2 node cluster. The disk is unused.
# oracleasm renamedisk -f [LABEL] [DISK_PATH] Instantiating disk "[LABEL]": done Writing disk header: failed Unable to label disk "[LABEL]"
Error in the system log:
oracleasm-write-label: Unable to open device "/dev/oracleasm/disks/[LABEL]": Device or resource busy Unable to label disk "[LABEL]"
The lsof tool did not show any open files. Checked on DB end, disk was not a part of disk group:
select mount_status,header_status from v$asm_disk where label=[LABEL] CLOSED PROVISIONED
1. Make sure configuration are correct in the configuration file /etc/sysconfig/oracleasm:
# ORACLEASM_SCANORDER: Matching patterns to order disk scanning ORACLEASM_SCANORDER="dm" # ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan ORACLEASM_SCANEXCLUDE="sd"
2. Make sure ASM disk is not created on to of “sd” device (lun path) rather than multipath disk. If so, we need to remove the multipath disk first and then ASM Device:
- Check the major minor number; Should be of multipath rather than “sd” disk.
# ls -l /dev/oracleasm/disks/XXXXXX
- You can check “dmsetup ls –tree” to confirm the name before removing it from multipath.
# dmsetup remove [mpathX]
- Run the below command on the same device.
# multipath –f [mpathX]
- below command is optional, executing it just to be sure:
# multipath –f [/dev/oracleasm/disks/XXXXXX]
- Confirm if the multipath disk is removed:
# dmsetup ls --tree # multipath -ll
- delete the oracleasm disk now:
# oracleasm deletedisk –v [XXXXXX]
3. Try deleting the disk and recreating the disk:
# oracleasm deletedisk [LABLE] # oracleasm createdisk [LABLE] /dev/mapper/xxxx
4. If you are facing same issue on disk deletion then clear the disk label manually and retry:
# dd if=/dev/zero of=/dev/mapper/xxxx bs=1024 count=100 # oracleasm deletedisk
Warning: The dd command will erase the disk header, No way of recovery without backup. Please be sure of the disk and partition you are running on. Please take backup before executing.
5. Try recreating the disk:
# oracleasm createdisk [LABLE] /dev/mapper/xxxx