Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 May 2007 21:27:56 +0800
From:      Zhang Weiwu <zhangweiwu@realss.com>
To:        freebsd-questions@freebsd.org
Subject:   ["solved"] Re: harddisk failed strangely, badly need to recover data
Message-ID:  <1178630876.13276.4.camel@joe.realss.com>
In-Reply-To: <1178613779.6328.85.camel@joe.realss.com>
References:  <1178613779.6328.85.camel@joe.realss.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Actually this is not solved. I have discovered that it will not be easy
to solve this problem and decided to accept the lose of data, that's how
it "solved"/

Basically the accident took place because one line in /etc/fstab was
wrong.

in /etc/fstab /dev/ad6s1c is used as swap, when FreeBSD boots, it
use /dev/ad6s1c as swap, destroying data blocks around these sectors.

[root@exupery /var/backups]# disklabel /dev/ad6s1
# /dev/ad6s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  c: 312576642        0    unused        0     0         # "raw" part, don't edit
  d: 312576642        0    4.2BSD     2048 16384 28552 

So in this case the 'c' partition as far as I can understand should not
be used for any purpose. I didn't intentionally create 'c' partition,
nor can I see this partition in Disk Label Editor of sysinstall. I don't
know why it's there.

Zhang Weiwu

On Tue, 2007-05-08 at 16:42 +0800, Zhang Weiwu wrote:
> Dear list. I added a 160 GB harddisk to the FreeBSD server several days
> ago. I have setup only one slice on it (/dev/ad6s1) and it has two
> partitions on it.
> 
> /dev/ad6s1c is used as swap
> /dev/ad6s1d is used as /var
> 
> Today I decided to reboot the FreeBSD server because I messed up nfs
> settings. After restart /var/ failed to mount. I was brought to a shell
> where I am suggested to do fsck manually. fsck manually couldn't help
> either:
> 
>         [root@exupery /home/zhangweiwu]# fsck /dev/ad6s1d
>         ** /dev/ad6s1d
>         Cannot find file system superblock
>         
>         LOOK FOR ALTERNATE SUPERBLOCKS? [yn] y
>         
>         32 is not a file system superblock
>         28780512 is not a file system superblock
>         57560992 is not a file system superblock
>         86341472 is not a file system superblock
>         115121952 is not a file system superblock
>         143902432 is not a file system superblock
>         172682912 is not a file system superblock
>         201463392 is not a file system superblock
>         230243872 is not a file system superblock
>         259024352 is not a file system superblock
>         287804832 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).
> 
> I tried to fix it by do inga harddisk bad-sector checking for the
> beginning 1GB of the harddisk (result is successful, no bad sector in
> the beginning 1GB). The data on the harddisk is not modified/erased
> during checking
> 
> Use 'dd if=/dev/ad6 bs=32k | hd -v | grep "19 01 54 19"' to locate the
> super block and do some calculation to get the superblock sector number
> (following an Internet article) and pass it to fsck_ufs like this:
> 'fsck_ufs -b 12032 /dev/ad6s1d'. Under a lot of time pressure I
> confirmed twice with 'y' for the following questions of whether or not
> to set some values to default without fully understanding the questions,
> later seeing more questions I stopped fsck by Ctrl+C.
> 
> Before running fsck I tried to backup the first 100MB data of /dev/ad6
> using dd which should help me recover even if I destroyed superblock
> of /dev/ad6s1d. Later I realized I have by mistake only backed up the
> beginning 4.0MB of /dev/ad6
> 
> Is it possible now for me to recover the data in /var/
> (especially /var/backups)? Thanks a lot in advance!
> 
> P.S. I am being really unlucky because this harddisk is mostly used for
> backup purpose and thus is not backed up (who back up the back-up
> harddisk?) and when I today failed to mount this harddisk, 0.5 hour
> later the server being backed up by it has got an accident and need the
> backup data to recover. 
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
-- 
Zhang Weiwu
Real Softservice
http://www.realss.com
+86 592 2091112




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