I accidentally left two different devices mounted on /opt
:
/dev/xvdf on /opt type ext4 (rw,relatime,seclabel,data=ordered)
/dev/md0 on /opt type ext4 (rw,relatime,seclabel,stripe=256,data=ordered)
It would be a problem to umount /dev/md0
, and things are using /opt
. /dev/md0
should be mounted on top of /dev/xvdf
. Any suggestions how I can just unmount /dev/xvdf
?
Tried:
[root@redacted ~]# umount /dev/xvdf
umount: /dev/xvdf: umount failed: Invalid argument
[root@redacted ~]# mount --move /dev/xvdf /temp
mount: bad option. Note that moving a mount residing under a shared
mount is unsupported.
Also I've had AWS support for volumes yell at me about force detaching in-use volumes, so that's not an option.
You cannot do it atomically. You can however do it with a sequence of
mount --move
commands. And you will need two other directories to use as mount points.Notice that the
/etc/mtab
entry for/dev/xvdf
may end up looking pretty weird in the end. So I recommend you create a copy of/etc/mtab
before you start such that you can reconstruct that entry once you are done.Anything opening paths through
/opt
while you are shuffling around the mount points may get unexpected results. But files and directories which were opened before you started will be unaffected by this maneuver.@kasperd solution didn't work for me, because I've received the message:
The easy solution is to comment out the offending mount point in file
/etc/fstab
, and reboot the server.You should be able to run: