A quick way to recover disks, on Linux, by relabeling the partition table, without initializing the metadata, for InfoScale and Storage Foundation

book

Article ID: 100033871

calendar_today

Updated On:

Cause

Aside from hard disk media faults, losing the partition table is the main cause that prevents the importation of a VxVM disk. The causes of a missing partition table vary, but can include ungraceful reboots, loss of hardware connectivity and third party applications.

Resolution

To recover a VxVM disk under such a circumstance, the VxVM disk can be re-labeled without initializing VxVM metadata, as long as the metadata is intact.

Here is a quick way to recover:

Warning: 
  • This procedure has the potential to cause data loss or corruption. Proceed with caution, or engage Veritas Technical Support for assistance.
  • The example below assumes that VxVM disk format is "cdsdisk." This is the default and is the most common format. Older systems still use the non-default "sliced" format. The method to recovery sliced disks may be different.
  • By default, VxVM on Linux is using "Sun" partition tables for the disk whose size is less than 2TB and "gpt" for  disks with sizes of 2TB, and larger.

1. Use two diskgroups, with different sized disks, such as 500M (dg1:disk_1) and 2TB (dg2:disk_2).
 
linux# vxdisk -o alldgs list
DEVICE       TYPE            DISK         GROUP        STATUS
disk_1       auto:cdsdisk    disk_1       dg1           online
disk_2       auto:cdsdisk    disk_2       dg2           online
linux# vxdisk -o size list
DEVICE                           SIZE(MB)     GROUP
disk_1                           500          dg1
disk_2                           2097153      dg2
 

2. For this example, the partition table for both disks is lost. The disk status appears as "online invalid."
 
linux# vxdisk -o alldgs list
DEVICE       TYPE            DISK         GROUP        STATUS
disk_1       auto: none       -            -            online invalid
disk_2       auto: none       -            -            online invalid


3. Verify that the disk partition table is lost, but the VxVM metadata is still intact:
  
3.a. For disk_1, whose size is less than 2TB, and the original label is "sun."
 
linux# parted -s /dev/vx/dmp/disk_1 unit s print | grep 'Partition Table'
Error: /dev/vx/dmp/disk_1: unrecognised disk label
Partition Table: unknown

linux# /etc/vx/diag.d/vxprivutil list /dev/vx/dmp/disk_1 | egrep 'group:|info:|public:|private:'
group:   name=dg1 id=1491362942.92.server101
public:  slice=3 offset=65792 len=954112
private: slice=3 offset=256 len=65536


3.b. For disk_2 whose size is over 2TB, and original label is "gpt"
 
linux# parted -s /dev/vx/dmp/disk_2 unit s print | grep 'Partition Table'
Error: /dev/vx/dmp/disk_2: unrecognised disk label
Partition Table: unknown

linux# /etc/vx/diag.d/vxprivutil list /dev/vx/dmp/disk_2 | egrep 'group:|info:|public:|private:'
group:   name=dg2 id=1491362964.94.server101
public:  slice=3 offset=65744 len=4294903504
private: slice=3 offset=256 len=65536

4. Recover the VxVM disk by re-labeling the partition table, without initializing VxVM metadata:

4.a. For disk_1, whose original label is "sun":
 
linux# parted -s /dev/vx/dmp/disk_1 mklabel sun
linux# partprobe /dev/vx/dmp/disk_1
linux# vxdisk init disk_1           // try to initialize without "-f" option to reread metadata, and ignore the warning message as follows
VxVM vxdisk ERROR V-5-1-5433 Device disk_1: init failed:
        Disk already initialized


4.b. For disk_2, whose original label is "gpt":
 
linux# parted -s /dev/vx/dmp/disk_2 mklabel gpt
linux# partprobe /dev/vx/dmp/disk_2 
linux# vxdisk init disk_2           // try to initialize without "-f" option to reread metadata, and ignore the warning message as follows
VxVM vxdisk ERROR V-5-1-5433 Device disk_2: init failed:
        Disk already initialized


4.c. Rescan and import the disks.
 
linux# vxdisk scandisks
linux# vxdisk -o alldgs list
DEVICE       TYPE            DISK         GROUP        STATUS
disk_1       auto:cdsdisk    -             (dg1)         online
disk_2       auto:cdsdisk    -             (dg2)         online
linux# vxdg import dg1
linux# vxdg import dg2
linux# vxdisk -o alldgs list
DEVICE       TYPE            DISK         GROUP        STATUS
disk_1       auto:cdsdisk    disk_1       dg1          online
disk_2       auto:cdsdisk    disk_2       dg2          online

Issue/Introduction

Veritas Volume Manager (VxVM), a component of InfoScale and Storage Foundation, relies on the Linux partition table, and its own VxVM metadata (private region data), to recognize a VxVM disk. Without either of them, VxVM is unable to import the disk.