问题原文
原帖链接 · creekorful · CC BY-SA 4.0
How ?
When trying to create a chrooted environment for some users, I end up using
mount --rebind <path> <newPath>
In order to allow chrooted users to access some useful command (a bad practice, yeah)
After some discussions with a colleague, I've change my mind and decide to use groups to blacklist some folder to chrooted users. After doing some
umount <path>
I end up doing a little rm -rf . to clean the last folder
The worst idea I've ever have
Sadly I have forget to umount the /usr/share folder and rm start to delete file in this directory. Hopefully I've done a quick
Ctrl + C
After i've noticed my mistakes. I was like "Cool there isn't too much damage"
I was really wrong.
All my services (mysql ; postregsql ; java) can't run anymore because they needed dependencies in /etc/alternatives Running a
update-alternatives --force --all
Help me a little bit but doesnt help starting mysql. I've totally lost faith in fixing this so i'd like to made a backup of every configurations file and perform a clean install of my vps. But like you think
I have no database backup
I know this is really really wrong, please forgive me.
My question
Now let's move on my question, is there a way to restore PostreSQL and MySQL connection in order to backup the database and save it to perform a clean install on my VPS ? Or I'm i totally lost ?
So far I've tried :
- recreate database socket (doesn't really work)
- regenerate mysql data files and move my blocks files into the folder (It help running back mysql, I can see the database and the table using SHOW DATABASES; and SHOW TABLES; but i can't access them)
Notes
In the futur I'll make backup, I promise
Update :
According to PostreSQL : https://www.postgresql.org/docs/9.1/static/backup-file.html there is a way to backup database using fs. I'll try that
Thank's for take the time to read me, hope you'll have and idea.
已采纳解答
原帖链接 · creekorful · CC BY-SA 3.0
For thoses who wonder if there is a solution, I've finally found one !
First I've download gdrive a Google Drive terminal client.
Then I've made several backup of all important directory (/home, /etc/nginx, ...) And for my MySQL and PostgreSQL server I've back up the following directory :
- /var/lib/mysql <-- for MySQL
- /var/lib/postgresql/9.3/main <-- for PostgreSQL
I've uploaded theses backup on my Google Drive and reinstall my VPS
Finally I've reinstall MySQL server stopped the daemon, backup the original /var/lib/mysql and download from Google Drive my old one. And after a little bit of fix on permission, the server has started ! And voila my database are back and functionnal !
I've not tested PostgreSQL data reimport but I think It'll work, i'll try tomorrow.
Anyway that will be a good lesson for me : no matter what, always perform backup !
Update
Just finish importing my PostgreSQL dump, nothing was lost !
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
