• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Enabling relatime on ubifs rootfs at boot?  (Read 2306 times)
Alucard
Newbie
*

Karma: 0
Posts: 10


View Profile
« on: September 22, 2010, 07:02:44 PM »

Hi,

How do I boot with / mounted relatime, when / is on ubi0?  I have a guruplug plus and am booting with:
Code:
bootargs=console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rw,relatime rootfstype=ubifs
but when it boots, relatime is missing:
Code:
# mount
rootfs on / type rootfs (rw)
Logged

sfzhi
Jr. Member
**

Karma: 1
Posts: 83


View Profile
« Reply #1 on: September 23, 2010, 12:48:54 AM »

The output of "mount" for the root file system is usually what you have in your /etc/fstab. It does not always reflect the actual mount options used. You should do "cat /proc/mounts" to see the real mount options.
Logged

Lack of knowledge is not such a big problem, unwillingness to learn is.

sfzhi
Jr. Member
**

Karma: 1
Posts: 83


View Profile
« Reply #2 on: September 23, 2010, 12:57:46 AM »

Another thing. "rw" is a special kernel boot parameter that is understood by the kernel as a mount option for the root file system. You can't just attach arbitrary mount options to it and expect it to work.
See http://www.kernel.org/doc/Documentation/kernel-parameters.txt.
Logged

Lack of knowledge is not such a big problem, unwillingness to learn is.

Alucard
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #3 on: September 23, 2010, 04:18:53 PM »

The output of "mount" for the root file system is usually what you have in your /etc/fstab. It does not always reflect the actual mount options used. You should do "cat /proc/mounts" to see the real mount options.
/ isn't in my fstab. What should my fstab line look like?  I found this post but trying "mount -o bind ubi0:rootfs  /mnt" says "special device ubi0:rootfs does not exist", so what special do I need to use?  I don't understand how / gets mounted on boot without an fstab line, anyway.

/proc/mounts does have relatime there after a boot.  Why would /sbin/mount and /proc/mounts differ? I thought the former just read the latter..

Another thing. "rw" is a special kernel boot parameter that is understood by the kernel as a mount option for the root file system. You can't just attach arbitrary mount options to it and expect it to work.
Thanks. I thought it was worth a shot, and it does seem to have worked.  Should I be passing 'ro' or 'rw'?  And back to my original question, what's the proper way to mount with relatime at boot - an fstab entry?
Logged

sfzhi
Jr. Member
**

Karma: 1
Posts: 83


View Profile
« Reply #4 on: September 24, 2010, 12:56:20 AM »

/ isn't in my fstab. What should my fstab line look like?
It isn't really needed at all. The / mount in /etc/fstab is just a "formality". The actual mount happens at boot time without /etc/fstab involved.

I found this post but trying "mount -o bind ubi0:rootfs  /mnt" says "special device ubi0:rootfs does not exist", so what special do I need to use?
If you are using "-o bind" then you are mounting a directory, not a device. Without "-o bind" the "mount" utility expects a device node (usually located in /dev).

I don't understand how / gets mounted on boot without an fstab line, anyway.
Well, try to imagine how it would work with fstab. To mount / you would need to read fstab first. But to read it you would need to mount / first. It's a chicken-egg problem. That must be why the root file system is mounted based only on the kernel boot parameters. In fact, fstab is used only by the "mount" utility, which is obviously not involved in mounting the root file system. People often add a line for / in fstab to let "mount" show it properly in the list of active mounts. That is also the reason why the options shown by "mount" can differ from the actual ones, which you can see in /proc/mounts.

/proc/mounts does have relatime there after a boot.
That means the root has been mounted with "relatime". It may be just the default behavior even if "relatime" is not explicitly specified. In that case you can be happy, as you don't have to do anything.

Why would /sbin/mount and /proc/mounts differ? I thought the former just read the latter..
"mount" normally reads /etc/mtab, not /proc/mounts. The former may or may not be a symlink to the latter. That depends on the distribution. If /etc/mtab is not a symlink then its contents are maintained by "mount" itself and can in some cases go out of sync with the reality.

Thanks. I thought it was worth a shot, and it does seem to have worked.  Should I be passing 'ro' or 'rw'?  And back to my original question, what's the proper way to mount with relatime at boot - an fstab entry?
As I mentioned, fstab has no influence on mounting the root. Everything should be specified with kernel boot parameters. You can use "rootflags" parameter to pass arbitrary mount options. However, if "relatime" is already in /proc/mounts then you don't need to do anything.
Logged

Lack of knowledge is not such a big problem, unwillingness to learn is.

Pages: [1]
Print
Jump to: