On Feb 8, 2016, at 6:03 AM, Benny Siegert wrote:
Hi!
This may be a stupid question but: Is there a way to make the entry
for the root filesystem in /etc/fstab just match whatever the kernel
used as the root FS?
It doesn't look like it. There is /kern/rootdev and /kern/rrootdev
which
provide a device file with the right major and minor numbers...
BUT ... kern isn't mounted yet, and isn't available single user, So
you CAN'T do this in fstab
/kern/rootdev / ffs rw 1 1
I think it would be great, if somehow one could have
/ / ffs rw 1 1
or maybe
a / ffs rw 1 1
I was thinking if something like "stat -f %Sd" , could tell you root,
then
really anything in C should be able to the same. But, I'm then I
realized,
there probably isn't a syscall to open a device just with major and
minor.
I'm also guessing a program can't mknod, open the the file, and then
delete
the device file (like you could with a regular file), and even if you
could
you couldn't unmount the filesystem...
But, then again if mount and fsck could stat /etc/fstab take st_dev ,
and
then translate either a / or single letter in fstab , and produce the
correct corresponding string for itself ,and any children it spawns
you could have a
"portable" fstab, and /etc/rc.d/fsck could stay the same. If the
corresponding
device doesn't exist to be found, you'd be no worse off, than if that
happened
presently, and no need for adhoc scripting.