If you just login as root then you shouldn't have any problems with the /home
mount. Still, if that is not possible, then you can simply mount --bind / /elsewhere
. By default --bind
type mounts are not recursive - and so the filesystems mounted to /
will not follow it when it is --bind
mounted somewhere else. You can recursively --rbind
a mount elsewhere though.
For example:
findmnt /esp; findmnt /
TARGET SOURCE FSTYPE OPTIONS
/esp /dev/sda1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda2[/arch_root] btrfs rw,relatime,compress-force=lzo,ssd,space_cache,autodefrag
As you can see, /esp
is mounted on /
.
mkdir /tmp/root
sudo mount --bind / /tmp/root
ls /esp /tmp/root/esp
/esp:
EFI/ shellia32.efi* shellx64.efi*
/tmp/root/esp:
Now I'll get a file into /tmp/root/esp
:
sudo touch /tmp/root/esp/blank_file
ls /esp /tmp/root/esp
/esp:
EFI/ shellia32.efi* shellx64.efi*
/tmp/root/esp:
blank_file
So I've created a file in the directory where /esp
is mounted. See?
sudo umount /boot /esp; ls /esp
blank_file
sudo mount -a; ls /esp
EFI/ shellia32.efi* shellx64.efi*
I had to umount /boot
and /esp
because /boot
is actually sourced from a bind mounted folder on /esp
. Both of these are defined in /etc/fstab
- which is why mount -a
brought them back.
mount --bind / /elsewhere
did the trick/elsewhere/home
was the 'original' version, as you pointed out. Many thanks for such a full explanation. – artfulrobot Dec 02 '14 at 23:15