Subject: kern/13574: can't remount root if the root device file inode has been changed
To: None <gnats-bugs@gnats.netbsd.org>
From: None <manu@netbsd.org>
List: netbsd-bugs
Date: 07/28/2001 02:01:31
>Number:         13574
>Category:       kern
>Synopsis:       can't remount root if the root device file inode has been changed
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 28 01:58:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Emmanuel Dreyfus
>Release:        NetBSD-current/macppc
>Organization:
The NetBSD Project
>Environment:
NetBSD violette 1.5X NetBSD 1.5X (LCOMP5) #0: Sat Jul 28 02:14:30 CEST 2001     root@violette:/usr/src/sys/arch/macppc/compile/LCOMP5 macppc
>Description:
Sometimes, we need to remount the root partition to change some attributes. Most common use it changing read/write status, by doing "mount -o ro /dev/sd0a /" or "mount -o rw /dev/sd0a".

mount(9) allow mounting an already-mounted partition because the new device file has the same inode as the already mounted device file.

If the device file inode changes, for instance because it has been deleted and re-installed, the kernel will not allow remounting any more.
>How-To-Repeat:
kill enough processes to be able to mount / as read-only (inlcudes syslogd, cron, xdm, sendmail... going to single user is the easiest way if you have many processes)

Assuming you booted off /dev/sd0a:
cd /dev
rm sd0a
./MAKEDEV sd0
mount -o ro /dev/sd0a /
mount_ffs: /dev/sd0a on /: specified device does not match mounted device
>Fix:
The current root device recognition, based on the inode might be too weak. Maybe this check could rely on the major/minor numbers instead of the inode?
>Release-Note:
>Audit-Trail:
>Unformatted: