re: HELP!! Slice info disappeared

1999-07-15 Thread Kazukiyo UEDA

Hello Niall and Josef,

Thanks for your great help.  

Finally I get all data on the disk back after the struggle on the
weekend :) I run the program you sent me, but I got nothing from it.
I guess the reason as follows:

(1) The program fetches each chunks of 16 blocks from the disk and
check if they are superblocks.

(2) My disk is sliced into 3 parts.  The fist one is for MS-DOS (FAT
format), and the rest of them are FFS.  It's highly possible that the
offset block of the beginning of FFS slice is not a multiple of 16.

(3) So I did:

# for i in 0 1 2 3 ... 15; do
# ./findsb /dev/wd2 $[ (estimated end of block for FAT slice)*512 + $i*512 ]
# done

After I got the info from the superblocks, getting back data was easy.
Again, thanks much for your great help.  You saved a lot of my time to
reconstruct the data from scratch.

Sincerely yours,

--
Kazukiyo Ueda

From: Josef Karthauser [EMAIL PROTECTED]
Subject: re: HELP!! Slice info disappeared
Date: Fri, 9 Jul 1999 10:01:16 +0100

 Hi Kazukiyo,
 
 This is certainly possible.  I've enclosed a hack from Niall Smart that should
 generated enough information to for you to reconstruct it.   I'm working on a
 general solution to this for inclusion FreeBSD as shipped, but it's at home
 and I'm at work, that said it's Niall's basic code saved my harddisk a few weeks
 ago :)
 
 Joe
 


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



re: HELP!! Slice info disappeared

1999-07-15 Thread Kazukiyo UEDA
Hello Niall and Josef,

Thanks for your great help.  

Finally I get all data on the disk back after the struggle on the
weekend :) I run the program you sent me, but I got nothing from it.
I guess the reason as follows:

(1) The program fetches each chunks of 16 blocks from the disk and
check if they are superblocks.

(2) My disk is sliced into 3 parts.  The fist one is for MS-DOS (FAT
format), and the rest of them are FFS.  It's highly possible that the
offset block of the beginning of FFS slice is not a multiple of 16.

(3) So I did:

# for i in 0 1 2 3 ... 15; do
# ./findsb /dev/wd2 $[ (estimated end of block for FAT slice)*512 + $i*512 ]
# done

After I got the info from the superblocks, getting back data was easy.
Again, thanks much for your great help.  You saved a lot of my time to
reconstruct the data from scratch.

Sincerely yours,

--
Kazukiyo Ueda

From: Josef Karthauser j...@pavilion.net
Subject: re: HELP!! Slice info disappeared
Date: Fri, 9 Jul 1999 10:01:16 +0100

 Hi Kazukiyo,
 
 This is certainly possible.  I've enclosed a hack from Niall Smart that should
 generated enough information to for you to reconstruct it.   I'm working on a
 general solution to this for inclusion FreeBSD as shipped, but it's at home
 and I'm at work, that said it's Niall's basic code saved my harddisk a few 
 weeks
 ago :)
 
 Joe
 


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message



re: HELP!! Slice info disappeared

1999-07-09 Thread Josef Karthauser

Hi Kazukiyo,

This is certainly possible.  I've enclosed a hack from Niall Smart that should
generated enough information to for you to reconstruct it.   I'm working on a
general solution to this for inclusion FreeBSD as shipped, but it's at home
and I'm at work, that said it's Niall's basic code saved my harddisk a few weeks
ago :)

Joe

- Forwarded message from Niall Smart [EMAIL PROTECTED] -

Date: Mon, 21 Jun 1999 13:48:45 +
From: Niall Smart [EMAIL PROTECTED]
Organization: Trinity Commerce
X-Mailer: Mozilla 4.6 [en] (X11; I; FreeBSD 3.2-STABLE i386)
X-Accept-Language: en
To: Josef Karthauser [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [DISKLABEL FRAGGED] Clues requested... ;)

Josef Karthauser wrote:
 
 Guess what... I've got a disk where the partition table and the disklabel has
 mysteriously disappeared!   Oops.
 
 I've reconstructed the partition table, and now need to partition the disklabel.

Wow, you're probably the first person ever to do that, unlucky you.  Out
of sympathy I've written you this findsb program which of course I've
never had to use myself. Its not the most efficiently written program
ever
and since FreeBSD swap partitions don't have magic numbers it may be
slow,
but it seems to work, however I draw your attention to the disclaimer
in the C file. ;)

Regards,
Niall

niall% disklabel wd0s2 | sed -n '/fstype/,$p'
#size   offsetfstype   [fsize bsize bps/cpg]
  a:   13107204.2BSD0 0 0   # (Cyl.0 -
8*)
  b:   262144   131072  swap# (Cyl.8*-
24*)
  c:  41929650unused0 0 # (Cyl.0 -
260)
  e:   819200   3932164.2BSD0 0 0   # (Cyl.   24*-
75*)
  f:  2980549  12124164.2BSD0 0 0   # (Cyl.   75*-
260*)
niall% ./findsb /dev/wd0s2 0 
found superblock: offset=16384, fs_size=65536, fs_fsmnt=/
suggested disklabel entry:

size   offsetfstype
  13107204.2BSD

found superblock: offset=24576, fs_size=65536, fs_fsmnt=
suggested disklabel entry:

size   offsetfstype
  131072   164.2BSD

^C
niall% ./findsb /dev/wd0s2 $[393216 * 512 - 8192 * 10] 
skipping 201244672 bytes
found superblock: offset=201342976, fs_size=409600, fs_fsmnt=/home
suggested disklabel entry:

size   offsetfstype
  819200   3932164.2BSD

found superblock: offset=201351168, fs_size=409600, fs_fsmnt=
suggested disklabel entry:

size   offsetfstype
  819200   3932324.2BSD

^C
PROG= findsb
CFLAGS  = -aout -static -W -Wall -Wmissing-prototypes -Wstrict-prototypes
MAN1=

.include bsd.prog.mk

/*
 * Copyright (c) 1999 Niall Smart.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *must display the following acknowledgement:
 *  This product includes software developed by Niall Smart, [EMAIL PROTECTED]
 *
 * THIS SOFTWARE IS PROVIDED BY NIALL SMART ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL NIALL SMART BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
*/


#include sys/types.h
#include sys/param.h
#include ufs/ffs/fs.h
#include stdio.h
#include unistd.h
#include fcntl.h
#include stddef.h
#include stdlib.h
#include limits.h

int
main(int argc, char** argv)
{
int fd;
int ret;
off_t   offset;
u_quad_tskip;
char*   ptr;
charbuf[SBSIZE];
struct fs*  fs = (struct fs*)buf;

if (argc != 3) {
fprintf(stderr, "usage: %s device skip\n", argv[0]);
exit(1);
}

if ( (fd = open(argv[1], O_RDONLY))  0) {
perror("open");
exit(1);
}

if ( (skip = strtouq(argv[2], ptr, 0)) == QUAD_MAX || *ptr != '\0') {
fprintf(stderr, "bad seek 

re: HELP!! Slice info disappeared

1999-07-09 Thread Josef Karthauser
Hi Kazukiyo,

This is certainly possible.  I've enclosed a hack from Niall Smart that should
generated enough information to for you to reconstruct it.   I'm working on a
general solution to this for inclusion FreeBSD as shipped, but it's at home
and I'm at work, that said it's Niall's basic code saved my harddisk a few weeks
ago :)

Joe

- Forwarded message from Niall Smart ni...@pobox.com -

Date: Mon, 21 Jun 1999 13:48:45 +
From: Niall Smart ni...@pobox.com
Organization: Trinity Commerce
X-Mailer: Mozilla 4.6 [en] (X11; I; FreeBSD 3.2-STABLE i386)
X-Accept-Language: en
To: Josef Karthauser j...@pavilion.net
CC: hack...@freebsd.org
Subject: Re: [DISKLABEL FRAGGED] Clues requested... ;)

Josef Karthauser wrote:
 
 Guess what... I've got a disk where the partition table and the disklabel has
 mysteriously disappeared!   Oops.
 
 I've reconstructed the partition table, and now need to partition the 
 disklabel.

Wow, you're probably the first person ever to do that, unlucky you.  Out
of sympathy I've written you this findsb program which of course I've
never had to use myself. Its not the most efficiently written program
ever
and since FreeBSD swap partitions don't have magic numbers it may be
slow,
but it seems to work, however I draw your attention to the disclaimer
in the C file. ;)

Regards,
Niall

niall% disklabel wd0s2 | sed -n '/fstype/,$p'
#size   offsetfstype   [fsize bsize bps/cpg]
  a:   13107204.2BSD0 0 0   # (Cyl.0 -
8*)
  b:   262144   131072  swap# (Cyl.8*-
24*)
  c:  41929650unused0 0 # (Cyl.0 -
260)
  e:   819200   3932164.2BSD0 0 0   # (Cyl.   24*-
75*)
  f:  2980549  12124164.2BSD0 0 0   # (Cyl.   75*-
260*)
niall% ./findsb /dev/wd0s2 0 
found superblock: offset=16384, fs_size=65536, fs_fsmnt=/
suggested disklabel entry:

size   offsetfstype
  13107204.2BSD

found superblock: offset=24576, fs_size=65536, fs_fsmnt=
suggested disklabel entry:

size   offsetfstype
  131072   164.2BSD

^C
niall% ./findsb /dev/wd0s2 $[393216 * 512 - 8192 * 10] 
skipping 201244672 bytes
found superblock: offset=201342976, fs_size=409600, fs_fsmnt=/home
suggested disklabel entry:

size   offsetfstype
  819200   3932164.2BSD

found superblock: offset=201351168, fs_size=409600, fs_fsmnt=
suggested disklabel entry:

size   offsetfstype
  819200   3932324.2BSD

^C
PROG= findsb
CFLAGS  = -aout -static -W -Wall -Wmissing-prototypes -Wstrict-prototypes
MAN1=

.include bsd.prog.mk

/*
 * Copyright (c) 1999 Niall Smart.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *must display the following acknowledgement:
 *  This product includes software developed by Niall Smart, 
ni...@pobox.com.
 *
 * THIS SOFTWARE IS PROVIDED BY NIALL SMART ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL NIALL SMART BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
*/


#include sys/types.h
#include sys/param.h
#include ufs/ffs/fs.h
#include stdio.h
#include unistd.h
#include fcntl.h
#include stddef.h
#include stdlib.h
#include limits.h

int
main(int argc, char** argv)
{
int fd;
int ret;
off_t   offset;
u_quad_tskip;
char*   ptr;
charbuf[SBSIZE];
struct fs*  fs = (struct fs*)buf;

if (argc != 3) {
fprintf(stderr, usage: %s device skip\n, argv[0]);
exit(1);
}

if ( (fd = open(argv[1], O_RDONLY))  0) {
perror(open);
exit(1);
}

if ( (skip = strtouq(argv[2], ptr, 0)) == QUAD_MAX || *ptr != '\0') {
fprintf(stderr, bad seek value: 

HELP!! Slice info disappeared

1999-07-08 Thread Kazukiyo UEDA
Hi hackers,

I need your helps, please.  I have two IDE drives.  They have two
slices for FreeBSD and Windows on each.  Last night I tried to install
Windows 95 on the first IDE drive where FreeBSD 3.1.0-Stable has
installed.  I executed fdisk program on MS-DOS and created an active
slice to make it C: on the first drive.  I successfully installed
windows, and then rebooted FreeBSD.  It's the beginning of my
nightmare.  On the boot time, kernel said there were no disklabel on
the second IDE drive or something like that (sorry, I was so in panic
that I didn't write them down on paper), and the system fall into
single user mode.  I checked the information for slices written on the
second IDE, but it was almost the same as the first one.  That is,
each slices on second IDE have the same size on the first one.  I
didn't know what happened but I guess fdisk program changed the slice
info not only for first IDE, but also the second one.  I suppose (or
wish) that the only slice information on the second IDE was
overwritten, and the data on the second IDE are still there without
any changes.  Is there any way to retrieve the slice info?  Any help
is much appreciated.

Thanks in advance,

--
Kazukiyo UEDA


To Unsubscribe: send mail to majord...@freebsd.org
with unsubscribe freebsd-hackers in the body of the message