root entry in /etc/fstab: first field (fs_spec) ignored
This may be well-known to some but I was surprised.
Apparently the first field for the / file system in /etc/fstab is ignored, replaced by the root= kernel parameter. Using legacy GRUB and booting this stanza: Code:
# Stanza 3 Code:
# <file system> <mount point> <type> <options> <dump> <pass> Code:
c@CW8:~$ df / |
hi
I don't use Slackware but on my grub2 system, df command looks correct. 1) have you tried a more recent kernel? 2) have you tried grub2 or interested in ? I am leaning towards this post....I am looking at the mount command http://www.linuxquestions.org/questi...xt2-fs-797354/ I am often wrong so forgive me if you just reporting and not asking. |
Thanks aus9 :)
Which OS are you using and do your kernel parameter root= and fstab / entry first field values differ? I am planning to use the new GRUB (why is it called GRUB2 when it's actually GRUB 1.99?) but have deferred the plan until it is convenient to re-partition the HDD because the Arch WIKI says regards MBR partitioning "Usually the post-MBR gap (after the 512 byte MBR region and before the start of the 1st partition) in many MBR (or msdos disklabel) partitioned systems is 32 KiB when DOS compatibility cylinder alignment issues are satisfied in the partition table. However a post-MBR gap of about 1 to 2 MiB is recommended to provide sufficient room for embedding GRUB2's core.img ([2]). It is advisable to use a partitioner which supports 1 MiB partition alignment to obtain this space as well as satisfy other non-512 byte sector issues (which are unrelated to embedding of core.img)". Actually I think the boot loader is irrelevant to what happens after it has loaded the kernel image and passed it the kernel parameters. The linked thread is interesting but is about ext2/3/4 file systems; as the OP shows the / file system is JFS. |
I am on debian sid....but use a liquorix kernel
my field don't vary....well I am actually using a UUID fstab but it truly links to correct /dev/sda1 structure b) and what I was trying to say in my vague manner is run the command mount and see what it reports mine is ok and consistent but me thinks you might have a gremlin when you run mount? |
Update
Update: the behaviour is diffferent and more misleading under Slackware64 14.0 which has the 3.2.29 kernel.
Using legacy GRUB and booting sda3 with this stanza ... Code:
title Slackware64 14.0 (1 TB HDD, Linux partition 3) Code:
/dev/sda14 / jfs noatime,errors=remount-ro 0 1 Code:
root@CW8:~# /bin/df
|
Update
The phenomenon seems to be a bug in df or wherever it gets its information from but there is one command which correctly detects which partition is mounted as root, lsblk. /proc/mounts is unhelpful.
Illustrating ... After booting via this GRUB stanza ... Code:
# Stanza 3 Code:
root@CW8:~# df /
|
Slackware's rc.S populates the missing entries of /etc/mtab after the root filesystem is remounted read-write using the "mount -f" fake-mount option. Specifically it does a /sbin/mount -f -w / which assumes that the fstab is correct and as such any inconsistency will be propagated to /etc/mtab and through it to all the other utilities such as 'df' that refer to it.
Of course, if you keep your fstab entry correct this isn't a problem, but perhaps pulling the root device from /proc/mounts rather than fstab would be more reliable when encountering untidy people who have the wrong value in their fstab. ;) Something along the lines of: /sbin/mount -f -w "$(grep -v '^rootfs' /proc/mounts | grep '^[^ ]\+ / ' | cut -f1 -d ' ')" / |
Thanks GazL :)
Appreciated. grep -v '^rootfs' /proc/mounts | grep '^[^ ]\+ / ' | cut -f1 -d ' ' yields /dev/root. Testing on Slackware64 14.0 (booted from /dev/sda14 which matches its fstab line for /) showed there is no /dev/root ...? On Slackware64 13.37 /dev/root was a symlink to the /dev/sd[[:lower:]] that was mounted as / IDK if the absence of /dev/root is usual or a strange feature of my personal computer. I browsed /lib/udev/rules.d/* files, looking for a rule that would create /dev/root but did not find. I could have missed it -- there are a lot of rules. EDIT: After posting that I looked for how /dev/root (the symlink and the /proc/mounts entry) are created. No clear picture emerged. The most illuminating pages were on the Gentoo Forums and lkml.org. |
This code could be used to reliably (?) find the root file system device file (fs_spec in fstab terminology) for use in the fake mount command:
Code:
buf=$(lsblk -o 'NAME,MOUNTPOINT' | grep '/$' | sed -r -e 's|[[:space:]]+/$||' -e 's/^[^[:alnum:]]+//') |
All times are GMT -5. The time now is 07:46 AM. |