Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Feb 1997 13:23:14 -0800
From:      "M.R.Murphy" <mrm@Mole.ORG>
To:        avalon@coombs.anu.edu.au, kuku@gilberto.physik.rwth-aachen.de
Cc:        hackers@freebsd.org, luigi@labinfo.iet.unipi.it, msmith@atrad.adelaide.edu.au
Subject:   Re: File system/disk recovery tools ?
Message-ID:  <199702172123.NAA26953@meerkat.mole.org>

next in thread | raw e-mail | index | archive | help
> > > > 
> > > > actually an annoying thing with fsck -b is that I never know what
> > > > to use as an alternate superblock number. 32, says the manpage, is
> > > > an alternate superblock, but what are others ? I guess they depend
> > > > upon the geometry of the disk... is there a "magic" number that I
> > > > can look for ?
> > > 
> > > You mean you didn't write them down when you made your filesystems? 8)

Ah, yes, I write them down each time :-) Never :-)

> > > 
> > > Ok, presumably your disklabel is OK.  Have a look in /sys/ufs/ffs/fs.h
> > > at the superblock layout; it's 8K long, has a fixed checksum, and
> > > contains various predictable fields (eg. the last mountpoint).  This
> > > should let you hunt a copy of it down.

# disklabel -r wd0
or
# disklabel -r sd0
or whatever , depending upon the drive in use,
then
# newfs -N wd0a
or
# newfs -N sd0s1f
or whatever, depending upon the disk and partition.

Notice the "-N" switch :-)

Like this:

  otchig# disklabel -r wd0
  # /dev/rwd0c:
  type: ESDI
  disk: wd0s1
  label: 
  flags:
  bytes/sector: 512
  sectors/track: 63
  tracks/cylinder: 16
  sectors/cylinder: 1008
  cylinders: 2100
  sectors/unit: 2116800
  rpm: 3600
  interleave: 1
  trackskew: 0
  cylinderskew: 0
  headswitch: 0           # milliseconds
  track-to-track seek: 0  # milliseconds
  drivedata: 0 
  
  8 partitions:
  #        size   offset    fstype   [fsize bsize bps/cpg]
    a:    49152        0    4.2BSD        0     0     0   # (Cyl.    0 - 48*)
    b:   262144    49152      swap                        # (Cyl.   48*- 308*)
    c:  2116800        0    unused        0     0         # (Cyl.    0 - 2099)
    e:   131072   311296    4.2BSD        0     0     0   # (Cyl.  308*- 438*)
    f:   196608   442368    4.2BSD        0     0     0   # (Cyl.  438*- 633*)
    g:  1477824   638976    4.2BSD        0     0     0   # (Cyl.  633*- 2099*)
  otchig# newfs -N wd0g
  Warning: 832 sector(s) in last cylinder unallocated
  /dev/rwd0g:     1477824 sectors in 361 cylinders of 1 tracks, 4096 sectors
          721.6MB in 23 cyl groups (16 c/g, 32.00MB/g, 7680 i/g)
  super-block backups (for fsck -b #) at:
   32, 65568, 131104, 196640, 262176, 327712, 393248, 458784, 524320, 589856, 655392, 720928, 786464, 852000, 917536, 983072,
   1048608, 1114144, 1179680, 1245216, 1310752, 1376288, 1441824,
  otchig# 
  
  
Someday I'll remember to write down a few of the alternate superblocks.
Yeah, in my dreams... :-)
  
--
Mike Murphy  mrm@Mole.ORG  +1 619 598 5874
Better is the enemy of Good



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702172123.NAA26953>