How to recover from a Sun disk label loss on Linux so that a VERITAS Volume Manager diskgroup can be imported

book

Article ID: 100022787

calendar_today

Updated On:

Description

Error Message

Disk /dev/sdm doesn't contain a valid partition table

Resolution

NOTE WELL:

There are a few assumptions that must be made clear before embarking on using this procedure:
- The user is 100% sure that ONLY the Disk VTOC is missing, possibly from incorrect use of fdisk.
- If the reason for the missing Disk VTOC is not known, the VxVM config data may be overwritten or wiped.
- This case study is to show that if the VXVM structures are not overwritten, then the VXVM config and data can be recovered.
- This procedure has not been tested on anything other than Sun Labeled disks on RHEL5.

RECOVERING FROM DISK LABEL LOSS ON LINUX:

This is an example on a system with Active/Passive storage Array. Consider /dev/sdm and /dev/sdg to be the SAME disk.
The test system was running VxVM 5.0MP3 on RHEL5 Linux.


DISK IN QUESTION (BEFORE CORRUPTION IS SEEN):

# vxdisk list sdg
Device:    sdg
devicetag: sdg
type:      auto
hostid:    sydopt4
disk:      name=sdg id=1261449359.84.sydopt4
group:     name=TEST id=1261449383.86.sydopt4
info:      format=cdsdisk,privoffset=256,pubslice=3,privslice=3
flags:     online ready private autoconfig autoimport imported
pubpaths:  block=/dev/vx/dmp/sdg3 char=/dev/vx/rdmp/sdg3
guid:      {9f652fc4-1dd1-11b2-b16b-24e7754723d7}
udid:      DGC%5FRAID%205%5FDD4VM1S%5F6006016043C01A00A560ECA37EA0DB11
site:      -
version:   3.1
iosize:    min=512 (bytes) max=1024 (blocks)
public:    slice=3 offset=65792 len=2031232 disk_offset=0
private:   slice=3 offset=256 len=65536 disk_offset=0
update:    time=1261451092 seqno=0.26
ssb:       actual_seqno=0.0
headers:   0 240
configs:   count=1 len=51360
logs:      count=1 len=4096
Defined regions:
config   priv 000048-000239[000192]: copy=01 offset=000000 enabled
config   priv 000256-051423[051168]: copy=01 offset=000192 enabled
log      priv 051424-055519[004096]: copy=01 offset=000000 enabled
lockrgn  priv 055520-055663[000144]: part=00 offset=000000
Multipathing information:
numpaths:   2
sdg     state=enabled   type=secondary
sdm     state=enabled   type=primary



## START OPTIONAL SECTION
INTENTIONALLY CORRUPT THE LABEL (skip this step if recovering):

# dd if=/dev/zero of=/dev/sdm bs=1 count=2048
2048+0 records in
2048+0 records out
2048 bytes (2.0 kB) copied, 0.012781 seconds, 160 kB/s


## END OPTIONAL SECTION



CONFIRM THE VTOC IS MISSING:

# fdisk -l /dev/sdm

Disk /dev/sdm: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes

Disk /dev/sdm doesn't contain a valid partition table


USE FDISK TO PUT A DEFAULT SUN DISK LABEL BACK ON THE DISK.
ACCEPT THE DEFAULTS DURING AUTOCONFIGURE:


# fdisk /dev/sdm
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): s
Building a new sun disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Drive type
  ?   auto configure
  0   custom (with hardware detected defaults)
  a   Quantum ProDrive 80S
  b   Quantum ProDrive 105S
  c   CDC Wren IV 94171-344
  d   IBM DPES-31080
  e   IBM DORS-32160
  f   IBM DNES-318350
  g   SEAGATE ST34371
  h   SUN0104
  i   SUN0207
  j   SUN0327
  k   SUN0340
  l   SUN0424
  m   SUN0535
  n   SUN0669
  o   SUN1.0G
  p   SUN1.05
  q   SUN1.3G
  r   SUN2.1G
  s   IOMEGA Jaz
Select type (? for auto, 0 for custom): 0
Heads (1-1024, default 34):
Using default value 34
Sectors/track (1-1024, default 61):
Using default value 61
Cylinders (1-65535, default 1009):
Using default value 1009
Alternate cylinders (0-65535, default 2):
Using default value 2
Physical cylinders (0-65535, default 1011):
Using default value 1011
Rotation speed (rpm) (1-100000, default 5400):
Using default value 5400
Interleave factor (1-32, default 1):
Using default value 1
Extra sectors per cylinder (0-61, default 0):
Using default value 0

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


AT THIS POINT THERE WILL BE A DEFAULT LABEL ON THE DISK:

# fdisk -l /dev/sdm

Disk /dev/sdm (Sun disk label): 34 heads, 61 sectors, 1009 cylinders
Units = cylinders of 2074 * 512 bytes

  Device Flag    Start       End    Blocks   Id  System
/dev/sdm1             0       960    995520   83  Linux native
/dev/sdm2  u        960      1009     50813   82  Linux swap
/dev/sdm3             0      1009   1046333    5  Whole disk


IN CASE VXVM STILL HAS THE DISK IN VXDISK LIST REMOVE IT SO WE CAN MODIFY LABEL:

# vxdisk rm sdg


FIX PARTITION TABLE FOR VXVM:

# vxdisk init sdg
VxVM vxdisk ERROR V-5-1-5433 Device sdg: init failed:
       Disk already initialized


THE ERROR V-5-1-5433 CAN BE IGNORED, BECAUSE WE ONLY WANT IT TO CORRECT THE LABEL.

# fdisk -l /dev/sdm

Disk /dev/sdm (Sun disk label): 34 heads, 61 sectors, 1009 cylinders
Units = cylinders of 2074 * 512 bytes

  Device Flag    Start       End    Blocks   Id  System
/dev/sdm3  u          0      1009   1046333    5  Whole disk
/dev/sdm8  u          0      1009   1046333    f  Unknown


RESCAN SO VXVM PICKS UP THE DISK

# vxdisk scandisks


CHECK THE DISK SHOWS group : "TEST"

# vxdisk list sdg | grep group
group:     name=TEST id=1261449383.86.sydopt4

Note:
For most systems, this procedure will need to be done on all disks that are missing their VTOC (Disk Label) before the diskgroup can be imported by VxVM.

IMPORT THE DISKGROUP:

# vxdg import TEST
#

CONFIRM DISKGROUP IS IMPORTED:

# vxdg list | grep TEST
TEST         enabled,cds          1261449383.86.sydopt4

 

 

Issue/Introduction

How to recover from a Sun disk label loss on Linux so that a VERITAS Volume Manager diskgroup can be imported