0

noob here

while working on a production server (old), i messed up a command and lock myself out of the gcloud compute engine instance (I know. dumb, stupid. I deserved them all).

I setup a new production server and loaded lamp, web app and a 2-day old database backup (lost 1 one day of work) but I had some time becuase it was the weekend so I decided to give it another shot recovering what was lost, so I put the web app in maintenance mode, mounted the old disk with the current data to /mnt/tmp/ on the new server and saw the original /var/lib/mysql, I was ready to replace the new var/lib/mysql for the old on the mounted disk (both servers were configured exactly in the same way so I think I was good to go). I stop working and opted to do it the next day.

When I started to work the next day I noticed that any change on the new /var/lib/mysql (like when doing # mv .bk) would be synced with /mnt/tmp/var/lib/mysql. why?? I also noticed that now the owner of /mnt/tmp/var/lib/mysql was mysql when the day before it was root.. why???

when I looked at my new database through the web app it sort of appears like I had a current and up to date database (no lost day)? why

I didn't do any rsycing.. never got the chance to replace the current /var/lib/mysql folder, never changed ownership?

any ideas why the old /mnt/tmp/var/lib/mysql and the new /var/lib/mysql folders were being synced up and who changed the ownerwhip of /mnt/tmp/var/lib/mysql ?

Thank you.

  • The simple answer is /var/lib/mysql is on a separate virtual disk (good practice, btw) and you also mounted that partition on the new server. – Brandon Xavier Jun 19 '17 at 06:46
  • Permissions of the mount point directory are [overwritten by the ones defined on the filesystem](https://serverfault.com/questions/39288/how-to-change-owner-of-mount-point).Not sure on the reason changes were taking place in both directories unless you have used the [“bind”](https://unix.stackexchange.com/questions/198590/what-is-a-bind-mount) option while mounting it or created a [symbolic link](https://unix.stackexchange.com/questions/80515/using-symbolic-link-on-directory-with-contents). – Carlos Sep 19 '17 at 17:54
  • As a side note, you should have been able to access the old server as long as you had project permissions. [Project wide SSH keys should sync with your server](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#block-project-keys) – Carlos Sep 19 '17 at 17:56

0 Answers0