Does anyone know whether /proc/mounts is guaranteed to be in the order in which devices are mounted?
For instance:
[root#machine proc]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
/dev /dev tmpfs rw 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
/proc/bus/usb /proc/bus/usb usbfs rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/sda1 /boot ext3 rw,data=ordered 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/dev/root /boot ext3 rw,data=ordered 0 0
In the above case, can I be sure that /boot will currently show /dev/root rather than /dev/sda1, which is currently hidden.
I'm guessing the same answer should be true of /etc/mtab.
I'm on RHEL 5.5.
The mount points in /proc/mounts are in mounted order. If you mount a new file system it gets appended to the list of filesystems, essentially obscuring the original mount point.
There are absolutely no guarantees about the content of /etc/mtab, it is purely managed by the userland mount command, so can be bypassed or rewritten arbitrarily, plus you can use the '-n' option to mount will actually omit placing entries in the /etc/mtab, thus making it incorrect relative to the kernel.
As a silly question, why do you need this information?
Related
I have a question I have a RO filesystem that is readonly. What I need to change in the file fstab in order to be able to edit system files or the all /etc/ directory editing. I can edit only fstab.
fstab file:
/etc # cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 rw,noauto 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
I do not know much about Linux, so I will be grateful for your help.
Try the following version and it should work independent of the contents of /etc/fstab:
mount -o remount,rw /dev/xxxx /
Instead of /dev/xxxx, use whatever device is valid for your drive.
this is my /etc/fstab file:
proc /proc proc defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/md/0 none swap sw 0 0
/dev/md/1 /boot ext3 defaults 0 0
/dev/md/2 / ext4 usrjquota=quota.user,jqfmt=vfsv0 0 0
How to enable noatime? I do not know exactly where to insert the string.
I think that is:
/dev/md/1 /boot ext3 defaults,noatime 0 0
That´s right? or Is in dev/md/2?
Many thanks.
Yes, that would work. But it makes more sense to delete the defaults placeholder when you add it:
/dev/md/1 /boot ext3 noatime 0 0
You probably care more about adding that mount option to slash, though:
/dev/md/2 / ext4 usrjquota=quota.user,jqfmt=vfsv0,noatime 0 0
How to remount as read-write a destination directory on device? (one folder) I need to replace file, but it's on "Read-only file system", not allow to change permissions. Path to folder: /etc/foo/bar. I need to remount /bar folder. Embedded Linux (busybox), Linux version 2.6.18_pro500
mount -o rw,remount [destination folder]
I tried following, with no success:
<root#elocal:/etc/foo/bar> ls -la
total 6
drwxr-xr-x 2 root 0 98 Jan 18 2011 .
drwxrwxr-x 7 root 0 105 Feb 10 2011 ..
-rw-r--r-- 1 root 0 1052 Jan 18 2011 file1
-rw-r--r-- 1 root 0 270 Jan 18 2011 file2
-rw-r--r-- 1 root 0 1088 Jan 18 2011 file3
-rw-r--r-- 1 root 0 270 Jan 18 2011 file4
mount -o rw,remount /etc/foo/bar
mount: can't find /etc/foo/bar in /proc/mounts
output mount command:
mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
proc on /proc type proc (rw)
ramfs on /var type ramfs (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock4 on /nvram type jffs2 (rw)
output of cat /proc/mounts
cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / squashfs ro 0 0
proc /proc proc rw 0 0
ramfs /var ramfs rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /dev tmpfs rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/mtdblock4 /nvram jffs2 rw 0 0
Normally, you would use mount -oremount,rw / (/ is the mount point, not /etc/foo/bar).
However, this will not work in your case, per the df output,
rootfs / rootfs rw 0 0
/dev/root / squashfs ro 0 0
your rootfs is using squashfs, which is a read-only file system. See Wikipedia link. Basically, when the filesystem image is created on the build system, it is compressed. Once it is on the target system, it cannot be changed.
You will need to go back to the build system and change the contents and re-build the filesystem image.
I'm running a custom Raspbmc build on my raspberry pi.
On startup, I always see the message
mount: / not mounted or bad option
The filesystem is still mounted, but still want to know whats causing the trouble.
my /etc/fstab looks like this:
proc /proc proc defaults,noatime,nodiratime 0 0
devpts /dev/pts devpts rw,nosuid,noatime,nodiratime,gid=5,mode=620 0 0
/dev/mmcblk0p1 /boot vfat ro,noatime,nosuid,nodiratime 0 0
UUID=7e790ee3-660b-46ab-8378-d8ea91730162 / ext4 defaults,data=writeback,nobh,nodiratime,noatime 0 0
tmpfs /home/pi/.xbmc/temp tmpfs rw,size=5M,nosuid,noexec,nodev,noatime,nodiratime,gid=1000,uid=1000 0 0
/tmp /var/tmp none rw,noexec,nosuid,nodev,bind 0 0
I would add "errors=remount-ro" after
ext4 default,errore=remount-ro,...
Just try to edit this, let me know-
I'm using ext2 FS on my embedded device (busybox) with readonly mode. But, when I check FS if its true readonly system. I found strange things: When I type cat /proc/mounts
rootfs / rootfs RW 0 0
/dev/root / ext2 ro,relatime,errors=continue 0 0
...
But in: /boot/grub/menu.lst
kernel=/boot/bzimage root=/dev/sda1 ro
in fstab:
/dev/root / ext2 ro,noatime,nodiratime,errors=remount-ro 0 1
in inittab:
null::sysinnit:/bin/mount -a
/bin/mount:
rootfs on / type rootfs (RW)
/dev/root on / type ext2 (ro,relatime,errors=continue)
I can't understand why rootfs mounted as RW (in case /proc/mounts and /bin/mount), and why arguments for mounting from fstab doesn't correspond to arguments in/bin/mount?
rootfs is the initial root filesystem at /. It is in RAM only, and is unreachable after /dev/root has been mounted over it.
/usr/src/linux/Documentation/filesystems/ramfs-rootfs-initramfs.txt