newfs for UFS2 problems
Lukas Ertl
l.ertl at univie.ac.at
Sat Apr 26 14:01:53 PDT 2003
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
===================================================================
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 22 Feb 2003 23:26:11 -0000 1.74
+++ sbin/newfs/mkfs.c 26 Apr 2003 20:54:56 -0000
@@ -113,6 +113,7 @@
quad_t sizepb;
int width;
char tmpbuf[100]; /* XXX this will break in about 2,500 years */
+ char dummy[SBLOCKSIZE];
/*
* Our blocks == sector size, and the version of UFS we are using is
@@ -479,8 +480,13 @@
sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree;
sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree;
}
- if (!Nflag)
+ if (!Nflag) {
+ if (Oflag != 1) {
+ memset(dummy, '\0', SBLOCKSIZE);
+ bwrite(&disk, SBLOCK_UFS1, dummy, SBLOCKSIZE);
+ }
sbwrite(&disk, 0);
+ }
for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize)
wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)),
sblock.fs_cssize - i < sblock.fs_bsize ?
---8<---
best regards,
le
--
Lukas Ertl eMail: l.ertl at univie.ac.at
UNIX-Systemadministrator Tel.: (+43 1) 4277-14073
Zentraler Informatikdienst (ZID) Fax.: (+43 1) 4277-9140
der Universität Wien http://mailbox.univie.ac.at/~le/
More information about the freebsd-current
mailing list