My / partition keeps filling up. To mitigate this, I'd like to move /opt to a different directory, /usr/local/foo, which is mounted to a different partition.

How do I do this safely? If I simply move /opt to /usr/local/foo/opt then create a link of some sort from /opt --> /usr/local/foo/opt, will all the permissions, bits, etc. be correctly set up?

I'm using Ubuntu.

rsync -a

followed by

mount --bind --make-slave
| improve this answer | |
  • Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?) – filbranden Sep 6 '18 at 2:00

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.