I'd like to make a temporary change to my fstab file so that my /home is on another drive. However, I don't want the whole partition to be mounted, but just a folder (home) on that partition. I'm OK with the rest of the data being unavailable.What's the canonical way of expressing this in fstab? I can't think of a way to do it in one command (as I can't reference a folder on a filesystem I haven't mounted). I think I should do a first mount and then move the folder to /home. But I don't know if I can do a move in fstab, haven't found it in man (and I don't feel like trying blindly because I only have ssh access to the machine right now).For now I have a bind mount in fstab:/dev/sdd1 /mnt/temphome ntfs defaults,errors=remount-ro 0 2/mnt/temphome/home /home none bindHowever this leaves /dev/sdd1 mounted in both points.To summarize:can I do a move mount operation in fstab and if yes, then how?is that the right approach and if not, what is?Thanks in advance.
Mount a folder on a drive in fstab. Move?
arch linux;mount;automounting;fstab
I don't think you can perform moves from /etc/fstab. If you want to do that, add a mount --move command in /etc/rc.local. That leaves a time in the boot process during which the home directories are not available at their final location. Since these are the home directories, they shouldn't be used much if at all during the boot process, so that's ok. The one thing I can think of is @reboot crontab directives. If you have any of these, the home directories need to be available, so you should add mount --move to the right place in /etc/rc.sysinit instead (just after mount -a).Using a bind mount is probably fine, though. What can go wrong is mainly processes that traverse the whole disk, such as backups and updatedb. Leaving the bind mounts in /etc/fstab is the least risky option, but you should configure disk traversal processes to skip /mnt/temphome/home.Yet another possibility is to make /home a symbolic link. However this may cause some programs to record the absolute path to users' home directories, which would be /mnt/temphome/home/bob. A bind mount or moving a submount doesn't have this problem.