Re: mount --move broken

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

 



Am 05.12.2010 21:49, schrieb Nix:
> On 5 Dec 2010, Jakob Unterwurzacher verbalised:
> 
>> Am 05.12.2010 18:07, schrieb Nix:
>>> mount --move doesn't work as specified in the manpage:
>>>
>>> ,----
>>> | # cd /tmp
>>> | # mkdir foo
>>> | # mkdir bar
>>> | # mount --move foo bar
>>> | mount: wrong fs type, bad option, bad superblock on /tmp/foo,
>>> |        missing codepage or helper program, or other error
>>> |        In some cases useful info is found in syslog - try
>>> |        dmesg | tail  or so
>>
>> man page says:
>>
>>        The move operation.
>>               Since  Linux  2.5.1 it is possible to atomically move a
>>               mounted tree to another place. The call is
>>                      mount --move olddir newdir
>>
>> The magic word is *mounted* I'm afraid, you can only move mountpoints.
> 
> Oh, that's rather crappy. This doesn't apply to MS_BIND, which is
> strange: are you sure this is actually a kernel restriction?

Yes,
# strace mount --move foo bar
gives:

mount("/tmp/foo", "bar", 0x805577c, MS_MGC_VAL|MS_MOVE, NULL) = -1
  EINVAL (Invalid argument)

-> The kernel says no.

>> cd /tmp
>> mkdir foo
>> mount --bind foo foo
>> mkdir bar
>> mount --move foo bar
> 
> I might just as well do a mount --bind in that case, which *can* be used
> on absolutely arbitrary directories (and indeed individual files).
> 
>> Though it does not do what you want as you will see foo's content in foo
>> AND bar.
> 
> That's what I'm trying to avoid. I thought MS_MOVE and MS_BIND together
> allowed this sort of cut-and-paste: apparently not. :/
> 
> I can probably get away with it by mounting a size-zero tmpfs over the
> original mount point after the bind operation. But, still, ew.

If you are *not* dealing with mountpoints, isn't renaming the directory
enough?
--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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