[net.unix-wizards] VAX 750/4.2 BSD disk trashing

RSanders@usgs2-multics.arpa (01/20/86)

Relevant background:
  VAX 750, 4.2 BSD with few bug fixes, Emulex SC750 disk controller,
  Unit 0 - CDC 160 Mb winchester
  Unit 1 - Fujitsu 2351A Eagle
  Unit 2 - Fujitsu 2351A Eagle (newly installed)

Situation:
  Frustrated by a "severe burn-in" format on the #2 Eagle not finishing
after 11 hours, I stupidly try to mount the root partition that used to
be there, while in multi-user mode:

  mount /dev/hp2a /mnt

Bam - crash.  Can't boot off CDC drive anymore - several zillion files
and directories trashed, including /etc/init.  Luckily I keep a fresh
copy of the root partition on Eagle #1, but still, 4 hours of restoring
files from backup tapes during prime-time has given me a bad reputation.

Questions:

  Why didn't I get a simple "no filesystem present", or similar error
message, from mount or the kernel?

  Why did unit 0 get trashed?  Too many obscure files were trashed for
me to believe that the lack of a "sync" before crashing caused the
damage.

Flames of the form "You shouldn't have mounted that f.s.  without
running newfs first" are no longer useful.

-- Rex

p.s.  The "severe burn-in" format for the VAX 750/SC750/Eagle combo I
now estimate takes 13-14 hours - it's running now.  The "several hours"
listed in format(8) is severely understated.

-----
  You say kernal, I say kernel (or is it the other way around?)

mwm%ucbopal@ucbvax.berkeley.edu (01/20/86)

You've just tripped over a known bug in 4.2 BSD. It's a symptom of a more
general problem: the mount system call is *stupid*. This has been fixed in
4.3.

I found the solution to your specific problem a while back, and mailed it
to the 4bsd-bugs list. You need to move a couple of lines about 1/2 dozen
lines in the mount call. The diffs follow.

	<mike
*** mount.fs.old	Wed Feb  6 17:07:11 1985
--- ufs_mount.c	Wed Feb  6 16:12:28 1985
***************
*** 87,92
  	mp->m_bufp = tp;	/* just to reserve this slot */
  	mp->m_dev = NODEV;
  	fs = tp->b_un.b_fs;
  	bp = geteblk((int)fs->fs_sbsize);
  	mp->m_bufp = bp;
  	bcopy((caddr_t)tp->b_un.b_addr, (caddr_t)bp->b_un.b_addr,

--- 87,94 -----
  	mp->m_bufp = tp;	/* just to reserve this slot */
  	mp->m_dev = NODEV;
  	fs = tp->b_un.b_fs;
+ 	if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE)
+ 		goto out;
  	bp = geteblk((int)fs->fs_sbsize);
  	mp->m_bufp = bp;
  	bcopy((caddr_t)tp->b_un.b_addr, (caddr_t)bp->b_un.b_addr,
***************
*** 94,101
  	brelse(tp);
  	tp = 0;
  	fs = bp->b_un.b_fs;
- 	if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE)
- 		goto out;
  	fs->fs_ronly = (ronly != 0);
  	if (ronly == 0)
  		fs->fs_fmod = 1;

--- 96,101 -----
  	brelse(tp);
  	tp = 0;
  	fs = bp->b_un.b_fs;
  	fs->fs_ronly = (ronly != 0);
  	if (ronly == 0)
  		fs->fs_fmod = 1;

davest%lumiere%tektronix.csnet@csnet-relay.a (David C. Stewart) (01/21/86)

	Another nice thing about 4.3 is that it doesn't crash when you mount
a garbaged filesystem.  It just gives an error message.  This has saved me
some time and embarrassment.

Dave
Tek