Re: disklabal messed, need help!

2003-04-05 Thread Ruslan Ermilov
On Wed, Mar 26, 2003 at 01:03:03AM +0800, af asdf wrote:
 
 Anyone knows how to repair disk when the freebsddisk lable is destroyed?
 
 I have a 12G HD, the 1st partition is Windows NT, the second the for 
 FreeBSD. For some reason i installed a new disk label to it and newfs it a 
 bit. Once I found the newfs started, I have turned power off right away, 
 but the disk is bad now. anyone knows how to repair this?
 
Yes.  Read the attached.


Cheers,
-- 
Ruslan Ermilov  Sysadmin and DBA,
[EMAIL PROTECTED]   Sunbay Software AG,
[EMAIL PROTECTED]   FreeBSD committer,
+380.652.512.251Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age
---BeginMessage---
Hi!

I have my disk set in a so-called dangerously-dedicated mode,
and its disklabel looks like this:

8 partitions:
#size   offsetfstype   [fsize bsize bps/cpg]
  a:  8388608   2621444.2BSD 1024  819216   # (Cyl.  260*- 8582*)
  b:   2621440  swap# (Cyl.0 - 260*)
  c: 199321920unused0 0 # (Cyl.0 - 19773)
  d: 11281440  86507524.2BSD 1024  819216   # (Cyl. 8582*- 19773*)

I recently upgraded the amount of RAM available on this machine
from 128M to 256M, and it took me a while to figure out why
swapon(8) no longer wants to enable swapping on `b' (which is
only 128M large).  I was pretty tired at the moment, and I thought
that maybe the problem is with the contents of my `b' partition,
so I did: dd if=/dev/zero of=/dev/ad0b bs=512 count=1000.  This
did not help, and eventually I recalled the fact of upgrading RAM,
and I've looked into some /sys/kern code to verify my guesses.
Nevertheless, I continued with my work on this machine, and compiled
and installed the new kernel (without any problems) on it.  Next
reboot refused to boot FreeBSD by mentioning that No operating
system was found.  I wondered how I managed to screw my disk up.
It was too late in the night, so I delayed it until the next morning.
The night and next morning gave me the knowledge about what I did
wrong, and it surprised me a lot, as I never thought about it before.
The disklabel occupies the first sectors of the disk (or slice, if
you are under i386 and have your disk sliced).  My `b' partition
starts from the very first sector of my disk, so when I did the
dd(1) it overwrote the disklabel of my disk with zeroes.  Once
I understood and verified it, I recovered from this very fast.
I remembered that my swap partition was first and exactly 128M
large, so I skipped over this space, and saved some amount of
my `a' partition into a plain file.  Fortunately, file(1) is
smart enough to read the superblock and tell you about the
size of the filesystems.  This way I found the size of my
`a' partition and an offset for my `d' partition.  Hope this
technique could help someone in a similar situation.  Now the
question.  Where is the code in the kernel that prevents swapping
and/or writing to a disklabel portion of a physically first
partition on the disk?


Thanks,
-- 
Ruslan Ermilov  Sysadmin and DBA,
[EMAIL PROTECTED]   Sunbay Software AG,
[EMAIL PROTECTED]   FreeBSD committer,
+380.652.512.251Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age


pgp0.pgp
Description: PGP signature
---End Message---


pgp1.pgp
Description: PGP signature


disklabal messed, need help!

2003-03-25 Thread af asdf
Anyone knows how to repair disk when the freebsddisk lable is destroyed?

I have a 12G HD, the 1st partition is Windows NT, the second the for 
FreeBSD. For some reason i installed a new disk label to it and newfs it a 
bit. Once I found the newfs started, I have turned power off right away, 
but the disk is bad now. anyone knows how to repair this?

Best Regards

Eric





_
 MSN Hotmail  http://www.hotmail.com  

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message