Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Apr 2009 22:20:21 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        John Almberg <jalmberg@identry.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: how to recover after power outage
Message-ID:  <20090406202021.GA25679@slackbox.xs4all.nl>
In-Reply-To: <C0C930E7-A989-4606-A516-040A2F894841@identry.com>
References:  <AF401DB4-C4D1-44B0-B9D2-A34D81596481@identry.com> <4ad871310904050141k11eda14vd8db9224f4384757@mail.gmail.com> <1ED100F1-51AE-478D-873C-40FF43EA17FB@identry.com> <gra0pd$tph$1@ger.gmane.org> <B695560F-1ED1-45F2-AEB2-2268045A01AC@identry.com> <gras5o$50f$1@ger.gmane.org> <EFC6BC14-1BCB-48F4-BB54-12F1A12663D9@identry.com> <C0C930E7-A989-4606-A516-040A2F894841@identry.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--sm4nu43k4a2Rpi4c
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Apr 06, 2009 at 02:08:18PM -0400, John Almberg wrote:
<snip>=20
> Okay, so my new database server is running with backup data and I am =20
> trying to salvage the old database, or what's left of it.
>=20
> Unfortunately, it seems like what's left of it, is not much.
>=20
> the /var/db/mysql directory tree is now a file:
>=20
> qu# ls -l /var/db/mysql
> -rwx------  2 mysql  wheel  1024 Jul  5  2008 /var/db/mysql

Normally it shouldn't be possible to turn a directory into a file. Using
open(2) to create a file that already exists as a directory should
result in an error.

> The situation looks hopeless to me. Is it?

It might not be. Unless the data was actively wiped or overwritten, the
data is probably still there on the disk in unallocated
sectors. Forensic analysis programs like the sleuth kit
[http://www.sleuthkit.org/sleuthkit/desc.php] _might_ be able to get
some of the data back. But don't hold you breath. It's practically
impossible to get data back from a modern drive once it has been overwritte=
n.

> Another question: given that the file system took a major hit, should =20
> I try to fix it, or just do a clean install? I'm leaning towards the =20
> clean install since I've been meaning to upgrade this machine to 7.1 =20
> anyway.

I would advise you to make a copy of the disk contents with dd, so you
can poke around in it at your leisure. Then check the disk with e.g.
smartmontools or the tools provided by the manufacturer and to a clean
install.

> Is there anyway to fix the file system, reliably? fsck doesn't seem =20
> to be able to solve all the problems.

Is that with fsck_ffs running in preen mode? If so, try it without the
-p option. If that doesn't work you might contemplate using the -D
option, but this can be dangerous; see fsck_ffs(8). If fsck_ffs even
then cannot repair the damage, there's not much you can do except wipe
the disk and reinstall. Also, check for loose (S)ATA cables. This can
cause g_vfs_done errors while the disk is fine. If there are no obvious
errors of that kind I'd be extra suspicious about disk hardware
failure. If the drive is still in warranty, I'd have it replaced. If
not, you might still think about replacing it. buying a new disk is
almost certainly cheaper that trawling through a diskload of data trying
to make sense of it...

Roland
--=20
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

--sm4nu43k4a2Rpi4c
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAknaZAUACgkQEnfvsMMhpyUKmwCggkWLgJo9OcLXq3ibzEdbE7A2
jNwAn3TIWE6fc4ZNxgRfZmySHtkPkuL1
=M65I
-----END PGP SIGNATURE-----

--sm4nu43k4a2Rpi4c--



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