Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 2003 23:01:41 +0200 (CEST)
From:      Lukas Ertl <l.ertl@univie.ac.at>
To:        freebsd-current@freebsd.org
Cc:        razor@ldc.ro
Subject:   Re: newfs for UFS2 problems
Message-ID:  <20030426225533.R743@leelou.in.tern>

next in thread | raw e-mail | index | archive | help
Alex Popa wrote:

> It seems the problem is partly caused by newfs on -current, which does
> not remove the old UFS1 magic when creating an UFS2 superblock at a
> different location.  This leftover magic is seen by the -stable kernel
> and therefore used.

Hi Alex,

could you try this patch to newfs(8)? It wipes the old UFS1 superblock
at location SBLOCK_UFS1 before writing the new superblock at location
SBLOCK_UFS2.

---8<---
Index: sbin/newfs/mkfs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /u/cvs/cvs/src/sbin/newfs/mkfs.c,v
retrieving revision 1.74
diff -u -r1.74 mkfs.c
--- sbin/newfs/mkfs.c=0922 Feb 2003 23:26:11 -0000=091.74
+++ sbin/newfs/mkfs.c=0926 Apr 2003 20:54:56 -0000
@@ -113,6 +113,7 @@
 =09quad_t sizepb;
 =09int width;
 =09char tmpbuf[100];=09/* XXX this will break in about 2,500 years */
+=09char dummy[SBLOCKSIZE];

 =09/*
 =09 * Our blocks =3D=3D sector size, and the version of UFS we are using i=
s
@@ -479,8 +480,13 @@
 =09=09sblock.fs_old_cstotal.cs_nifree =3D sblock.fs_cstotal.cs_nifree;
 =09=09sblock.fs_old_cstotal.cs_nffree =3D sblock.fs_cstotal.cs_nffree;
 =09}
-=09if (!Nflag)
+=09if (!Nflag) {
+=09=09if (Oflag !=3D 1) {
+=09=09=09memset(dummy, '\0', SBLOCKSIZE);
+=09=09=09bwrite(&disk, SBLOCK_UFS1, dummy, SBLOCKSIZE);
+=09=09}
 =09=09sbwrite(&disk, 0);
+=09}
 =09for (i =3D 0; i < sblock.fs_cssize; i +=3D sblock.fs_bsize)
 =09=09wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)),
 =09=09=09sblock.fs_cssize - i < sblock.fs_bsize ?
---8<---

best regards,
le

--=20
Lukas Ertl                             eMail: l.ertl@univie.ac.at
UNIX-Systemadministrator               Tel.:  (+43 1) 4277-14073
Zentraler Informatikdienst (ZID)       Fax.:  (+43 1) 4277-9140
der Universit=E4t Wien                   http://mailbox.univie.ac.at/~le/



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