Skip to content

Instantly share code, notes, and snippets.

@hakanensari
Created May 10, 2013 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakanensari/5552869 to your computer and use it in GitHub Desktop.
Save hakanensari/5552869 to your computer and use it in GitHub Desktop.
You are on OVH, have gone with the default layout on a box, and now realise you'd rather mount differently.
  1. Make sure you allow root to ssh in: Edit your /etc/ssh/sshd_config, add your public key to root's authorised keys, and so on.
  2. Move home, e.g. mv /home /home.bak.
  3. Comment out the line that mounts home in /etc/fstab.
  4. Reboot.
  5. Rename home.bak back to home.
  6. Stop PostgreSQL.
  7. mv /var/lib/postgresql /var/lib/postgresql.bak.
  8. Edit /etc/fstab, remove comment and replace /home with /var/lib/postgresql.
  9. Create /var/lib/postgresql with chown it to postgres:postgres.
  10. Mount it.
  11. Move contents of postgresql.bak to postgresql.
  12. Start PostgreSQL.
  13. Clean up after yourself: Revert your ssh config, remove the key you've added to root, etc.
@hakanensari
Copy link
Author

I lied in #2. I actually copied cp -Rp /home /home.bak and was trying to simplify in the writeup. @ezkl pointed out mv doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment