Re: mount: remount and -n don't mix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 27, 2010 at 04:33:48PM -0400, Andrew Lutomirski wrote:
> # touch foo
> # touch bar
> # mount -n --bind foo bar
> # mount -n -o remount,ro bar
> mount: can't find bar in /etc/fstab or /etc/mtab
> 
> That seems like an oversight -- why is -o remount looking at
> /etc/fstab and /etc/mtab at all?  Especially when I set -n.

 The syscall requires mount source and target, you have specified
 'bar', that's ambiguous request. Man mount:

    The remount functionality follows the standard way  how  the mount
    command  works  with options from fstab. It means the mount
    command doesn’t read fstab (or mtab) only when a device and dir
    are  fully specified.

> There are a few ways I can think of to fix this:
> 
> 1. Make mount -n  (or mount --use-proc) look at /proc/self/mounts
> instead of /etc/mtab.

 The /proc does not contain all necessary information. For example
 'bind' flag is not stored there. It means that for the read-only bind 
 remount you have to explicitly use --bind option. 
 
 If you have a system with /etc/mtab then mount(8) is able to read the
 'bind' flag from the file.

> 2. Make mount -n -o remount not care about mtab and just issue the syscall.

 It works, you have to specify all necessary information on command
 line, it means:

    mount -o remount,for,bar <source> <target>


On Thu, May 27, 2010 at 04:57:27PM -0400, Andrew Lutomirski wrote:
> This works:
> 
> # mount -n --bind -o remount,ro none bar
> 
> Perhaps that should go in the man page.  This isn't intuitive at all.

 I'll add a note to the man page that --bind is required for the remount 
 on systems without /etc/mtab.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux