Mounting a file system with superblock 32

Duckbreath duckbreath at yahoo.com
Mon Jul 14 09:43:48 UTC 2014



Thanks for the helpful responses.

I tried the dumpfs utility-
# dumpfs /dev/da0a
dumpfs: /dev/da0a: could not read superblock to fill out disk
# dumpfs /dev/da0b
dumpfs: /dev/da0b: could not read superblock to fill out disk
# dumpfs /dev/da0e
dumpfs: /dev/da0e: could not read superblock to fill out disk
# dumpfs /dev/da0f
dumpfs: /dev/da0f: could not read superblock to fill out disk
# dumpfs /dev/da0
dumpfs: /dev/da0: could not read superblock to fill out disk


I'm somewhat perplexed that fsck_ffs -b 32 thinks the disk is fine.


So, I decided to pay the sourcecode of dumpfs.c a visit!The error message I get is probably the product of ufserr(name);


       while ((name = *argv++) != NULL) {
                 if (ufs_disk_fillout(&disk, name) == -1) {
                         ufserr(name);
                         eval |= 1;
                         continue;
                 }


The function ufs_disk_fillout() is a a core/system function with a manpage, essentially an attempt to fill out a structure so it can print the disk information within it for the dumpfs utility.

So my journey continues to where this onerous function which DARES (sorry, some list humor...) not to see my superblock as defined, 

/usr/src/lib/libufs/type.c and I see this definition:

 int ufs_disk_fillout(struct uufsd *disk, const char *name)
  {
          if (ufs_disk_fillout_blank(disk, name) == -1) {
                  return (-1);
          }
          if (sbread(disk) == -1) {
                  ERROR(disk, "could not read superblock to fill out disk");
                  return (-1);
          }
          return (0);
  }


Ok, so there is my error message.  sbread(disk) is returning -1.  If you have a crafty eye, you'll see some really bad error handling practices coming up next, because sbread() already has more meaningful errors and they are overwritten by ufs_disk_fillout's generic error of "could not read".  Those error messages should not be overwrriten!

Anyway, sbread() is a bit long, so it would be inappropriate to post it in its entirety, but it returns -1 upon tripping the following error messages defined within it on the respective line numbers:

 66                         ERROR(disk, "non-existent or truncated superblock");
 87                 ERROR(disk, "no usable known superblock found");
111                         ERROR(disk, "Failed to read sb summary information");


So unfortunately I don't know which of the three my disk is falling in.  I could try to write a stub and see?

I find it odd though that fsck_ff -b 32 does not have a problem with this, but the code that attempts to seek the super block.... well... it looks valid.  But it could be failing on the other two?  Who knows. :)


The drive AFAIK is good, or always was.  It's file system is a bit dated, heralding back to the FreeBSD 5.0 days...




________________________________
From: "kpneal at pobox.com" <kpneal at pobox.com>
To: Duckbreath <duckbreath at yahoo.com> 
Cc: "freebsd-fs at freebsd.org" <freebsd-fs at freebsd.org> 
Sent: Saturday, June 28, 2014 3:40 PM
Subject: Re: Mounting a file system with superblock 32


On Fri, Jun 27, 2014 at 08:35:49PM -0700, Duckbreath via freebsd-fs wrote:
> 
> 
> Hello all, I have a hard drive that represents an older installation of FreeBSD and I would like to access it.  Using a USB -> IDE connection device the drive appears as:
> 
> /dev/da0[x*]   where x* is various letters 'a', 'e', 'f', which no doubt represent the partitions from the previous installation.
> 
> 
> A simple mount doesn't work though, returning an error message about unrecognized device.

Can you cut-n-paste the exact command you used and the exact error message?

Oh, and can you run "gpart show da0" (or whatever the entire disk appears as)?

Are you trying to mount the exact same partition as the one that fsck says
is fine?

> A simple usage of fsck_ff however shows the file system clear,
> fsck_ff -b 32 /dev/da0a returns system clean, and newfs -N will give me various facts about the drive (blocksize, fragment size, cylinder groups, blocks, indoes, and sectors).

I don't think newfs -N is what you want. Rather, try dumpfs or ffsinfo to
get info on what is actually on the disk.

With newfs -N you are getting what newfs would put if it hadn't been given
the "-N" option. Meaning, that's the "dry run" option for when creating a
new filesystem.

> Googling around has shown that perhaps the mdmfs utility is what I need.

Doubtful. I'm guessing a typo when using the mount command.




> This fits my definition of non-trivial.  Any of you know how to mount a UFS1 drive?

It should work. Show us the command that fails and the message it prints
if you would. That might give the clue needed.
-- 
"A method for inducing cats to exercise consists of directing a beam of
invisible light produced by a hand-held laser apparatus onto the floor ...
in the vicinity of the cat, then moving the laser ... in an irregular way
fascinating to cats,..." -- US patent 5443036, "Method of exercising a cat"


More information about the freebsd-fs mailing list