HOW TO RECOVER FILE AFTER DROPLET RESTART- UBUNTU 16.04

September 7, 2018 1k views
MySQL Apache

I all of a sudden started encountering this error “sshexchangeidentification: read: Connection reset by peer” . then i tried turning off the droplet and on again and when i connected back the the linux, all my files on /var/www/html was wiped out, the sudo service mysql start returns this error: Sep 07 09:10:36 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: Failed to start MySQL Community Server.
Sep 07 09:10:36 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Unit entered failed state.
Sep 07 09:10:36 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Failed with result ‘exit-code’.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: Stopped MySQL Community Server.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: Starting MySQL Community Server…
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 mysql-systemd-start[5980]: MySQL system database not found in /var/lib/mysql. Please run mysqld –initialize.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Control process exited, code=exited status=1
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: Failed to start MySQL Community Server.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Unit entered failed state.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Failed with result 'exit-code’.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: Stopped MySQL Community Server.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: mysql.service: Start request repeated too quickly.
Sep 07 09:10:37 ubuntu-s-2vcpu-4gb-sfo2-01 systemd[1]: Failed to start MySQL Community Server.

I have tried sudo mysqld —initialize and I got this error:
2018-09-07T08:45:45.504752Z 0 [ERROR] Can’t change data directory owner to mysql
2018-09-07T08:45:45.504983Z 0 [ERROR] Aborting

i have tried the recovery steps on this tutorial : https://www.digitalocean.com/docs/droplets/resources/recovery-iso/ with no luck.

Please how do I restore my os / recover my files. Thanks

1 Answer

Hey friend!

This situation is a bit deeper than anyone can know from an external perspective. If you have a system administrator that you trust, you should ask them to review that server for you. Files don’t really just go missing from a reboot, and it’s especially odd if they do and yet the operating system still boots (as that kind of file system corruption is unlikely to specifically target items non-essential to boot).

My concern is that your server was compromised and configured by an attacker to act this way. Most likely you’re not going to restore that data in a meaningful way and should start pulling your external backups. I would not re-deploy on this server, but I would have a sysadmin look at it to see if any evidence remains of what occurred so that it might be prevented.

Jarland

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!