Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Sep 2001 04:03:33 +0200
From:      Piet Delport <siberiyan@mweb.co.za>
To:        freebsd-stable@freebsd.org
Subject:   "fixlabel: invalid magic" while dd'ing to /dev/ad4s1
Message-ID:  <20010927040332.C96979@athalon.homenet>

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

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

Hi stable people,

Some verbose background (hurried folks can skip to "end background"):

A while back, while i was installing FreeBSD onto a free slice on this
box, i accidentally overwrote the start of my first slice (which
contains a Winders 98 installation) with the FreeBSD boot loader,
instead of installing it in the MBR.

The result is that said Win98 slice is now unbootable (FreeBSD gets
booted instead when i try) and unmountable (both from FreeBSD and a DOS
boot floppy).  Not too big a deal, as my most important data is
elsewhere, and the Windows installation is expendable, but there's still
one or two non-backed-up files on the Win98 slice that i'd like to
recover.  Which is what i set out to do, in the name of Knowledge,
Prosperity, and Copious Free Time.

Initial investigation revealed that only the first 8K of /dev/ad4s1 (the
Windows boot slice) differed from a normal FAT32 filesystem header, a
convenient example of which exists in the form of /dev/ad4s5, my other
FAT32 slice.  So, by restoring the first 8K of ad4s1 from ad4s5, i am
hoping to make ad4s1 usable again, at least enough so that i can recover
my files.

[end background]

I tried the following:

# dd if=3D/dev/ad4s5 of=3D/dev/ad4s1 bs=3D512 count=3D16

but dd replied with:
| dd: /dev/ad4s1: Read-only file system
| 2+0 records in
| 1+0 records out
| 512 bytes transferred in 0.022429 secs (22828 bytes/sec)

Note that the first 512 bytes were indeed written to ad4s1, but nothing
more was.

Additionally, the kernel reported:
| dscheck(#ad/0x20022): fixlabel: invalid magic
| fixlabel: invalid magic

For what it's worth, 0x20022 seems to be the minor device number of
/dev/ad4s1:

$ ls -l /dev | grep 20022
crw-r-----   2 root  operator  116, 0x00020022 Sep 27 01:47 ad4s1
crw-r-----   2 root  operator  116, 0x00020022 Sep 27 01:47 rad4s1
$

Searching various manpages didn't shed any light on the error messages,
so i grepped the FreeBSD source tree for "fixlabel: invalid magic" and
found (the only) match in sys/kern/subr_diskslice.c:

|     /* These errors "can't happen" so don't bother reporting details. */
|     if (lp->d_magic !=3D DISKMAGIC || lp->d_magic2 !=3D DISKMAGIC)
|         return ("fixlabel: invalid magic");
|     if (dkcksum(lp) !=3D 0)
|         return ("fixlabel: invalid checksum");

Unfortunately, my non-existent kernel-fu precluded me from gleaning
anything meaningful from the code, other than that this probably
shouldn't happen.

I should also mention that i tried:

# disklabel -W ad4s1

after reading about it in disklabel(8), but i still got the same error
message.  I also tried dd'ing to/from /dev/rad4s? instead of /dev/ad4s?,
with no success.

Am i doing something wrong here, is this a bug, or what?

Thanks in advance for any replies,

--=20
Piet Delport <siberiyan@mweb.co.za>
Today's subliminal thought is:

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)

iD8DBQE7soj0zRUP82sZFCcRAhuWAJ9glNo8v95D4dYGoh9AMc34dB4dZgCdFNe4
0liUS5RV4TrcT8UX2gN5m1M=
=RxVP
-----END PGP SIGNATURE-----

--liOOAslEiF7prFVr--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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