So this story happened to me recently. My client got a Odoo server running on DigitalOcean for quite sometime. And suddendly one day everything just stop working. The web app is down. I can not access to the server through ssh. Hard reboot also not work. Then I contacted DO people for support.
I got the feedback from DO’s guys in an instance. He said our droplet has been corrupted. And suggested me to do is to investigate the droplet, check for bad stuff with
fsck ; pretty much I did following this article https://www.digitalocean.com/community/tutorials/how-to-recover-from-file-system-corruption-using-fsck-and-a-recovery-iso
After spending nearly 2 days following the above approach I learn some quite interesting stuff. However I realize that the droplet cannot be recorvered. So I was thinking of a simpler solution which is simply get the needed data and move them to a new droplet.
And this can be done with few simple step:
*NOTE*: the database in this case is Postgresql, and no backup has been made before. And I cannot run any
pg_dump or any other helpful commands inside corrupted droplet.
- I need to get the droplet into the recovery mode. This step need the support DO’s guys to enable.
- Then I need to mount the device, enable network connection, and enable SSH (this is vital step)
- Now I can ssh into the server, and everything will be under this folder /mnt
- Next, I need to locate where is the data directory of postgresql is. This can be done by looking at this file /mnt/etc/postgresql/9.x/main/postgresql.conf
- When you know the data directory. That’s the place Postgresql store everything. So all I need to do is copy all of those files to a safe place.
- Now I need to setup a new droplet instance with Odoo available. Then paste all of the file above into the data directory of the new instance.
That’s all. Quite simply isn’t it. You might run into some small problems with the process above, such as:
- the data directory need to be owned by
posgresuser instead of
- you also might need to shutdown the postgresql service while you do the copy and paste process.
Other than that. Enjoy a new droplet!