Re: finding alternate superblocks in ffs

From: Erik Udo (erik.u_at_dnainternet.net)
Date: 10/31/04

  • Next message: Joan Picanyol: "Re: finding alternate superblocks in ffs"
    Date: Sun, 31 Oct 2004 16:46:23 +0200
    To: freebsd-hackers@freebsd.org
    
    

    What if you repartition & slice the disk exactly the way it was in
    sysinstall, and then Toggle Newfs off, and write changes. It worked
    fine for me.

    Christoph P. Kukulies wrote:
    > Yesterday a major desaster happened: I stumbled across the power cable of my
    > Dell Inspiron notebook. The notebook fell to the floor. FreeBSD was running
    > at that time. Nothing seemed to got damaged, just a palm rest popped off.
    >
    > Ah yes, the HD bay sprung off and in a moment of reflex I pushed it
    > in again in the running system. After that I tried to mount the
    > disk (which had not been mounted at that point of time). Anyway,
    > trying to
    >
    > # fsck_ffs /dev/ad2s1e
    > ** /dev/ad2s1e
    > Cannot find file system superblock
    >
    > LOOK FOR ALTERNATE SUPERBLOCKS? [yn] y
    >
    > 32 is not a file system superblock
    > 89808 is not a file system superblock
    > 179584 is not a file system superblock
    > 269360 is not a file system superblock
    > 359136 is not a file system superblock
    > 448912 is not a file system superblock
    > 538688 is not a file system superblock
    > 628464 is not a file system superblock
    > 718240 is not a file system superblock
    > 808016 is not a file system superblock
    >
    > ....
    > 20813728 is not a file system superblock
    > 20903504 is not a file system superblock
    > 20993280 is not a file system superblock
    > 21083056 is not a file system superblock
    > 21172832 is not a file system superblock
    > 21262608 is not a file system superblock
    > SEARCH FOR ALTERNATE SUPER-BLOCK FAILED. YOU MUST USE THE
    > -b OPTION TO FSCK TO SPECIFY THE LOCATION OF AN ALTERNATE
    > SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck(8).
    > #
    >
    > Any idea what I can do now?
    >
    > I wrote a little program that opens /dev/ad2s1e
    >
    > #include <stdio.h>
    > #include <sys/param.h>
    > #include <sys/stat.h>
    > #include <sys/file.h>
    > #include <sys/time.h>
    > #include <sys/mount.h>
    > #include <sys/resource.h>
    > #include <sys/sysctl.h>
    > #include <sys/disklabel.h>
    >
    > #include <ufs/ufs/dinode.h>
    > #include <ufs/ufs/ufsmount.h>
    > #include <ufs/ffs/fs.h>
    >
    >
    > #include <fcntl.h>
    > #include <ufs/ffs/fs.h>
    > main(){
    > int fd;
    > int k,i=0;
    > int buf[512/(sizeof (int))];
    > if((fd=open("/dev/ad2s1e",O_RDONLY)) < 0)
    > printf("error opening device\n"),exit(2);
    > printf("opened device\n");
    > while(read(fd,buf,512)>0){
    > for(k=0;k<(512/(sizeof (int)));k++){
    > /*if(buf[k]==FS_UFS1_MAGIC)
    > printf("UFS1 * %d\n",i),fflush(stdout); */
    > if(buf[k]==FS_UFS2_MAGIC)
    > printf("UFS2 * %d\n",i),fflush(stdout);
    > i++;
    > }
    > }
    > }
    >
    >
    > I'm not sure whether my approach is correct.
    > Anyway, the blocks I find with that method
    > aren't recognized as superblocks either.
    >
    >
    > --
    > Chris Christoph P. U. Kukulies kuku_at_kukulies.org
    > _______________________________________________
    > freebsd-hackers@freebsd.org mailing list
    > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    >
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Joan Picanyol: "Re: finding alternate superblocks in ffs"