I'm trying to mount /etc/folder and /var/folder to the same external volume UUID=xyz. This external volume already has subdirectories etc_folder and var_folder and has been formatted and available to mount. I want to change fstab and achieve something like the following, before doing "mount -a":

UUID=xyz:/etc_folder /etc/folder    ext4    defaults,nofail        0       2
UUID=xyz:/var_folder /var/folder    ext4    defaults,nofail        0       2

But this doesn't work... what exactly should I put in fstab?

  • Why not mount it once then put a symlink at the other location pointing to the first? – thrig Mar 14 '17 at 15:14
  • My team wants to avoid using a symlink as it's not best practice. Upon googling I think I could use 'bind' somehow but I'm not sure how – ru111 Mar 14 '17 at 15:19
  • What happens on mount -a? – Philippos Mar 14 '17 at 15:29
  • It throws me an error saying it can't find "UUID=xyz:/etc_folder", don't think it likes the syntax – ru111 Mar 14 '17 at 15:33

The following works in /etc/fstab:

UUID=xyz /mnt   ext4    defaults,nofail        0       2
/mnt/var_folder   /var/folder     none    bind                      0       0
/mnt/etc_folder    /etc/folder     none    bind                      0       0

I just need to mount the whole volume to one location e.g. /mnt, keep it there and create binds (seems very much like a symlink).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.