Migrate from a backup

I was trying to decrypt my Linux server hard drive but ran into some problems.  Long story short, I now want to reinstall Ubuntu on my machine and restore my previous JIRA database from a hard drive backup on an external hard drive.  In other words, I cannot boot from my hard drive backup but have all the data and want to restore my JIRA database from where it sat on the computer before I messed it up.  I do not have a JIRA backup, only a hard drive backup.  Can this be done?  Can I install JIRA and run it using the database on this hard drive so I can migrate it back to the machine?  What steps do I need to take?  What problems might I run into?  Thanks for any and all help!

3 answers

1 accepted

Since I had no database dump and simply a hard drive backup to work from, I had to patch together several techniques to get back my JIRA installation.  I don't know if I will be able to recall all of the specifics but I can try:

  1. Install MySQL on the newly installed OS and PHPMyAdmin (for testing).  Keep your usernames and passwords the same.
  2. Locate on both the new OS and on the backup of the old system where MySQL data is stored (mine was var/lib/mysql).
  3. Replace the new machine's MySQL data with that of the old machine.  You will need to mess with the permissions in order to do this but make sure you restore those permissions as close as possible so that MySQL will work and your files will be protected.  This means making sure the owner of those files is mysql or mysqld and that the permissions are something like 700 (I changed it to 777 to make the changes).  This is rough because I didn't record everything before I changed things but make sure that you do so that you do a better job than I did.  If you cannot connect to the database, the server ID is probably incorrect in your /etc/mysql/debian.cnf file.  They say you shouldn't edit it but I was desperate so I replaced the new server ID with the one from my backup and it connected.  Since it was the same server, just rebuilt, I had little guilt over that.
  4. Install JIRA and configure it.  If you can remember the exact version you were on before, get that one.  If not, get as close as possible (I avoided mixing major version changes i.e. JIRA 7 as opposed to JIRA 6).  When I configured it, I kept it using an internal database so I could connect things later.  I also had to install the JIRA DB connecting plugin, so if you need that, install it.
  5. Replace the JIRA home directory contents with your backup's contents.  This will also require that you mess with permissions and you should restore them afterwards just like before.  This should reset everything to connect to your database if everything matches up correctly.
  6. At first I got a 404 error because my JIRA build number was incorrect.  I tried to find out what version I was on by the logs from my old JIRA installation but I got the version number incorrect.  I downloaded a new version of JIRA and reinstalled it and everything connected.

I may not have been as complete with every step so don't be surprised if you run into errors.  With good enough Googling, you should be able to get past every step.  Keep in mind this was on Ubuntu 14.0.4 and JIRA v6.4.2#64017 (build number is important, I now know).  It's entirely possible this will work on other distros but the steps will be different, at least as far as the locations of things are.  I cannot attest as to whether this will work with other databases though.  If anyone is as dumb as I am, hopefully this helps you out!

We do following to create new test JIRA instance:

  1. making backup (admin panel => import&export => Backup system)
  2. Install new empty JIRA instance
  3. Copy backup into new instance file system (<JIRA directory>\Application Data\JIRA\export)
  4. import data from back up

It works well.

 

Vasiliy, thanks for the quick response but I didn't word my question correctly.  I don't have a JIRA backup, I have a backup of a hard drive where JIRA used to be installed.

I see. I have never used this, but during installation of JIRA there is an ability to create JIRA from database. 

See this for instractions: https://confluence.atlassian.com/jira/running-the-setup-wizard-185729463.html

Namely see "Production and testing setup" where you can select database to connect.

Also pay attention, that attachements are not stored into database. You have to copy it manually.

You need to get two things from the disk - the attachments, which Vasiliy already mentioned, which is a simple case of "copy a directory", and the database, which could be difficult. 

Problem with the database is that it varies between installs.  "What database were you using?" is the first question, as it determines how to recover it.

Hi,

if you have a dump of the database  you can bring back to life your old JIRA instance witouth much trouble. I've done it recently, having MySQL as DBMS.

The steps I followed:

    1. Delete current database:
      # mysql -u root -p
      mysql> drop database jiradb;
    2. Create database again, as done in the first step.
    3. Restore the dump:
      # nohup mysql -u root -p jiradb < ./your_dump.sql 

  • Start JIRA service

You might have problems due to missing plugins and so. You'll need to examine the log, to discover and fix possible issues.

Good luck!

 

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

461 views 1 15
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot