Ubuntu crashed - /home available but cannot boot drive and access ERPNext

Hi, my ubuntu OS is corrupted, so I have bought a new HDD and reinstalled ubuntu 16.04 and erpNEXT (ubuntu recovery did not work). I can mount my old HDD and can access the old /home and see all my old files on the drive with the dead OS.

I have an old backup of my erpNEXT, but we did a lot of work in the last two weeks so will loose this data if I cannot recover last working version (I know I should back up each day!).

Just wondering is there a safe way to extract my old working erpNEXT from my old drive in /home and import it on my new Ubuntu server with a clean erpNext install?

Any help or suggestions to recover my old files much appreciated.


Your best option would be to get hold of the mariadb data files usually located /var/lib/mysql and restore from those files to a new db. There are many resources online that will guide through the process of doing so.

Once you have restored the old db files you can then restore ERPNext to the latest version of the data you had.


Hi Said,

Thanks for the reply. The mysql files are all there. To back the files up I need to know the dB name. I’m not familiar with the mySQL tools. I have found ways to use mysqldump but I don’t know the database name. Can you please point to a mysql reference for this?

Assuming I get the dump from the old dB is the next step just running $bench force restore using the sql dump??


In mysql…
The db you want is the one with a weird name like “d56cb677ea…”

More info is here


I had created a new install of erpNEXT and I can open the mariadb for this install using:

mysql -u root -p 1bd3e0294da19198

where 1bd3e0294da19198 is the name of the erpNEXT dB of the new install of erpNEXT. The old erpNEXT dB version is located in the dir below:

mysql -u root -p /media/kombo/959a912e-63f8-45b2-9da2-6be04598f63f/var/lib/mysql/1bd3e0294da19198

But this returns an error :

ERROR 1102 (42000): Incorrect database name ‘/media/kombo/959a912e-63f8-45b2-9da2-6be04598f63f/var/lib/mysql/1bd3e0294da19198’

Even though the filename is verbatim to what is in the dir. Is there something obvious I am doing wrong top access the old file?

create a new (temporary) database with a different name (ie. not 1bd3e0294da19198).
open the OLD copy of 1bd3e0294da19198, and copy the data to the new temporary DB.
then unmount/unload the old 1bd3e0294da19198, and copy the data from the temporary db to the new 1bd3e0294da19198 one.

Hi trentmu,

I can open the fresh installed erpNext dB and I have created a new dB on the same server, but I cannot find a way to open the old database? If I use the full path to the old dB it returns an error. Can you please advise steps to open the old dB. The command SHOW DATABASES just returns the new databases, it does not locate the old dB (the one I need to recover).


It might be easiest to just stop the mysql service, copy the files from the other HDD, and then restart mysqld.


I meant restoring the physical files from the old database.

Follow the steps in this stack exchange

The db name should a more or less identical to the new one you created, since they all differ it will be not be possible for me to determine the db name on your end

Hope this helps


I have copied the old mysql dir into the /var/lib. I have not done anything to the files or erpnext. I have just attempted to restart mysql but I get the error message below and it aborts:

/var/lib$ sudo systemctl start mysql
Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details.

When running these the message is:

ec 03 21:41:47 k-erp mysqld[25987]: 171203 21:41:47 [ERROR] Failed to initialize plugins.
Dec 03 21:41:47 k-erp mysqld[25987]: 171203 21:41:47 [ERROR] Aborting
Dec 03 21:41:47 k-erp mysqld[25987]:
Dec 03 21:41:47 k-erp mysqld[25987]: 171203 21:41:47 [Note] /usr/sbin/mysqld: Shutdown complete
Dec 03 21:41:47 kombo-erp mysqld[25987]:
Dec 03 21:42:17 kombo-erp mysql[25629]: …fail!

Any help much appreciated

is your mysql the same version as on the old/crashed system?

tail /var/log/error.log
for errors