Can not move tmpfs mounts
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
mount --move fails with -EINVAL on tmpfs mounts. Is there some reason for this, or is it a long standing kernel bug?
A bind mount followed by unmounting the original works, but seems like this workaround should not be needed.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBCgAGBQJWVSWDAAoJEBB5UWFcu6UWRJoH/RWUUbuLp0Jh54pXuRTaOp32 lTBNmFL3st9PVIWZw6vJmTWTekTDsqo/+BbqIxhq2Xm3BbuXMONuFRvp0ZeUAfmq U2hjJzbIag+3TtxmULT5j5VuMHZUxzYjQDsTfSX/yyNrH9MjKt+MdxbvReYmesI4 ztozVmlM0ucgfIw27wY6jsgChFe/vAHAaIKL7FQ6Ya8pxPA00zRMAYJR/NegTwKD yLW6mZnTJGtkIG3lC/8rOaqgYJStH3FU/1z390Fr0ZYWRMP2aMRHmMJWMx8lJ4+1 ZvFPS2T9Z3PnWTfrPMsbWzHJy3i8UaWItcRjpw27KKXmA1NMnQdL69+GDmJ4AnQ= =wnEH
-----END PGP SIGNATURE-----
Karel Zak
maintainerQuoted 5 lines · Phillip Susi
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512mount --move fails with
-EINVALon tmpfs mounts. Is there some reason for this, or is it a long standing kernel bug?
Are you sure the problem is tmpfs? I guess you have problem with propagation flags (shared vs. private), probably systemd based system where all is shared by default.
# mount -t tmpfs tmpfs /mnt/test
# strace -e mount mount --move /mnt/test /mnt/test2
mount("/mnt/test", "/mnt/test2", 0x563e27385f00, MS_MGC_VAL|MS_MOVE, NULL) = -1 EINVAL (Invalid argument)
mount: bad option. Note that moving a mount residing under a shared
mount is unsupported.See the mount(8) output message (it's also in mount(8) man page), let's fix it:
# findmnt -o TARGET,PROPAGATION /mnt TARGET PROPAGATION /mnt shared
# mount --make-private /mnt
# strace -e mount mount --move /mnt/test /mnt/test2
mount("/mnt/test", "/mnt/test2", 0x55a092f54f00, MS_MGC_VAL|MS_MOVE, NULL) = 0Note that the problem is not with the mountpoint (/mnt/test in my example), but with parent -- unfortunately usually "/" ("/mnt" in my example).
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Quoted 3 lines · Karel Zak
Are you sure the problem is tmpfs? I guess you have problem with propagation flags (shared vs. private), probably systemd based system where all is shared by default.
I could have sworn it worked with an ext4 fs, but yea, you are right... it is the shared flag. Why can't you move a mount point when it is in a shared namespace?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBCgAGBQJWWOVRAAoJEBB5UWFcu6UWRTgH/A8+RAOWPp5unIbUrWGZcLtv g1aFe8+KZ9Ggpn7P3H3qg0eNh2S0SSqNQxz5XgJ4dw50SawdulBAqMx4rl4XmTaQ 260nE3ZRMF6r65k61DKh5m0baqP4duWtIB9uDBPWg4p/hx7fgZghHHqCbfm5o3Ig Z2EqXZ/XIj+2n5JwpRiH4JNj3ahFUIGto3rCrlyIDEJ1G9C39ASNtu1YydvI/f+T x04o19+Kp0elUM/HNfdinKBYPq4IR8tPSImjw4sC8VhFYx+hJTHznC6pzwJyzEN0 KKaQfn9bzEn33UMrytLIHC7S5mamU9EHAUx3xSj9i1soTqKwSVcIELMXOYq+V1Q= =VtA4
-----END PGP SIGNATURE-----