DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 4th December 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Thanked 0 Times in 0 Posts
Default powersurge - missing mbr?

2 days ago we had a powersurge and no electricity for 1 hour. After the power came back i turned on my server only to notice that i needed to run manual fsck_ffs for wd4. Being very busy in rl i shut off the power.

Now i got a little time over so i started the server, entered shell and tried
disklabel -p wd4
and according to disklabel there is no partitions at all, luckily this wasnt very important data but still, i havent "lost" data like that, might have been a few blocks but this seems to be the mbr?

Is there some sort of way to possibly restore the mbr?
doing fsck wd4 i get
Cant open /dev/wd4a: device not configured
Reply With Quote
  #2   (View Single Post)  
Old 4th December 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

Does the kernel see wd4?
Code:
grep wd[0-9] /var/log/messages
What does fdisk wd4 say?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #3   (View Single Post)  
Old 4th December 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Thanked 0 Times in 0 Posts
Default

Code:
fdisk wd4
3: A6  0  1  1  1453515  14  63  63: 14665144002 OpenBSD
Looks like its there...
Reply With Quote
  #4   (View Single Post)  
Old 4th December 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

Yes something is there, but it looks messed up. Compare with one of mine
Code:
$ fdisk wd1

Disk: wd1       geometry: 38913/255/63 [625142448 Sectors]
Offset: 0       Signature: 0xAA55
          Starting         Ending        LBA Info:
 #: id      C   H  S -      C   H  S [       start:        size ]
------------------------------------------------------------------------
 0: A5      0   1  1 -   5220 254 63 [          63:    83875302 ] FreeBSD     
*1: A6   5221   0  1 -  10441 254 63 [    83875365:    83875365 ] OpenBSD     
 2: 00      0   0  0 -      0   0  0 [           0:           0 ] unused      
 3: 00      0   0  0 -      0   0  0 [           0:           0 ] unused
Could you post your complete fdisk output?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #5   (View Single Post)  
Old 4th December 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Helpful companion
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Thanked 193 Times in 184 Posts
Default

That is the MBR partition table, it resides in the first 512 bytes of the disk.. OpenBSD's disklabel resides within the MBR partition.

I can't explain how things got mangled like that, but a copy of it would have resided in /var/backups.

Does /var/backups/disklabel.wd4.current have what you need?

EDIT: J65nko may have spotted further issues, full output from commands in [code][/code] blocks would be appreciated.
Reply With Quote
  #6   (View Single Post)  
Old 4th December 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Thanked 0 Times in 0 Posts
Default

Code:
#fdisk wd4

Disk: wd4     geometry: 1453521/16/63 [1465149168 Sectors]
Offset: 0       Signature: 0xAA55
          Starting         Ending        LBA Info:
 #: id      C   H  S -      C   H  S [       start:        size ]
------------------------------------------------------------------------
 0: 00      0   0  0 -      0   0  0 [           0:           0 ] unused      
 1: 00      0   0  0 -      0   0  0 [           0:           0 ] unused      
 2: 00      0   0  0 -      0   0  0 [           0:           0 ] unused      
*3: A6     0   1  1 -  1453515 14 63 [    63:    1465144002 ] OpenBSD
Reply With Quote
  #7   (View Single Post)  
Old 4th December 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Helpful companion
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Thanked 193 Times in 184 Posts
Default

That looks fine, not sure what he was hinting at.. can you check that file? presumably you haven't kept this system running after the disk issue .

You never posted the output of disklabel, either.
Reply With Quote
  #8   (View Single Post)  
Old 4th December 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Thanked 0 Times in 0 Posts
Default

This is current disklabel wd4
Code:
# Inside MBR partition 3: type A6 start 63 size 1465144002
# /dev/rwd4c:
type : ESDI
disk: ESDI/IDE disk
label: SAMSUNG HD753LJ
flags: 
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
tracks/cylinder: 1008
cylinders: 1453521
total sectors: 1465149168
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0                  # microseconds
track-to-track seek:  0        # microseconds
drivedata: 0 

16 partitions:
#     size      offset  type   [fsize bsize cpg]
c: 1465149168    0     unused
and this is disklabel backup from /var/backups/disklabel.wd4.current
Code:
# Inside MBR partition 3: type A6 start 63 size 1465144002
# /dev/rwd4c:
type : ESDI
disk: ESDI/IDE disk
label: SAMSUNG HD753LJ
flags: 
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 1465149168
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0                  # microseconds
track-to-track seek:  0        # microseconds
drivedata: 0 

16 partitions:
#     size       offset   type   [fsize  bsize cpg]
a: 1465144002    63     4.2BSD     2048 16384 328
c: 1465149168    0       unused
So this is obviosly wrong, can i just edit the faultydata with fdisk (using backupdata and it should work?
Reply With Quote
  #9   (View Single Post)  
Old 5th December 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

No, you should use disklabel wd4 to re-add the lost a partition.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 5th December 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Thanked 0 Times in 0 Posts
Default

I edited what was needed, but i cant access the cpg-value. Dont have a clue what it actually is. Any way to access/change the value would be more then welcome
Code:
#     size       offset   type   [fsize  bsize cpg]
a: 1465144002    63     4.2BSD     2048 16384 1
i used disklabel -E wd4. tried with -e but doesnt work because of readonly...

Last edited by knasbas; 5th December 2009 at 09:25 AM. Reason: changed the cpgvalue. changed from quote2code
Reply With Quote
Old 5th December 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

After editing with disklabel -E wd4 how does it look like now?
BTW Please use code tags instead of quote tags

IIRC values like cpg are a result from the newfs formatting command
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 5th December 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,612
Thanked 214 Times in 189 Posts
Default

You can use the backup disklabel without hand editing at all. See the disklabel(8) man page, and read about -R.
Reply With Quote
Old 6th December 2009
knasbas knasbas is offline
Port Guard
 
Join Date: May 2008
Posts: 25
Thanked 0 Times in 0 Posts
Default

Thank you for help!
disklabel -R worked and now everything is back to normal!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sys.tar.gz missing from 3rd CD in 4.5? thirdm OpenBSD Installation and Upgrading 0 5th May 2009 03:25 PM
Disk space gone missing EricM FreeBSD General 0 26th February 2009 02:25 AM
The case of the missing 24GB Bruco FreeBSD General 3 20th October 2008 06:44 PM
Update from 6.3 to 7.0 (libs missing etc.) Calderon FreeBSD Installation and Upgrading 16 17th May 2008 09:03 PM


All times are GMT. The time now is 07:37 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick