TurnKey Linux Virtual Appliance Library

Restored backup to the cloud - missing folder

eyvind's picture

I tried to restore a joomla 1.6 turnkey backup to the cloud using the hub. It restored ok, but I am missing an important folder I have created in /usr/share.

How do the TKLBAM work in this regard? Are there any "special" folders that are not backed up and thus is not restored, or is this a bug?

Regards, 

Eyvind B

Jeremiah's picture

/usr/share is not an included folder

/usr/share is not an included folder because it is not considered best practice according to the Filesystem Hierarchy Standard (FHS) to manually install content there.  It is better to install under one of the following folders:  /opt, /srv, /home, /usr/local.   You'll find that each of those folders are included in the TKLBAM default profile so they will get backed up.

The default backup profile is located in /var/lib/tklbam/profile.  It includes a file "packages" that lists the packages necessary for the TKL appliance.  It also includes a file "dirindex.conf" that lists what default folders should be included and excluded from the TKLBAM backup.

The /etc/tklbam/overrides file is where you override the default TKLBAM profile.  There is a lot of good documentation in that file so be sure to take a look at it.

One more thing to be aware of is that the /var/lib/tklbam/profile directory will not be populated with the appliance's default TKLBAM profile until after the tklbam-init command has been run since that command installs the latest profile from TKLHUB.

Jeremy Davis's picture

Not a bug; /usr/share should be read only, static data!

[edit] Jeremiah beat me to it! And he gave you a heap more practical info too! Oh well I'll leave my reply here anyway... :)

In other words, according to the FHS (Filesystem Heirarchy Standard) the only data that should be in /usr/share is put there by apps installed by package managment. And as TKLBAM checks for additionally installed packages, anything there would be replaced during restore when the package is automatically reinstalled (assuming the app in question was from a default repo). OTOH if the data comes from a package from a custom repo or from a manually installed deb, then it should be replaced when the package is (manually) reinstalled. As such, there should be no need for TKLBAM to backup anything from there.

As an end user, putting folders in /usr/share is considered 'naughty'! I guess that doesn't help you much right now though. Hopefully you have a copy of the data in question somewhere!?

For the record, TKLBAM doesn't scan your whole harddrive for files to backup, it only looks in specific places. That is why backups can be so small (and fast to backup). Assuming you follow the FHS rules that shouldn't be an issue. Having said that, if you wish it to backup files in other ('naughty') places you can force it too, although you are probably better off just putting stuff you want backed up in places it will look.

Hopefully this discovery hasn't caused you too much pain, but I guess this is a good example of how important it is to test your backups before you need them, to ensure that you don't get any nasty surprises.

Jeremiah's picture

Backing up "system" folders could corrupt a restored server

Ha, I knew it was only a matter of time before you would reply Jeremy.
It's rare that I can offer some help in these forums but when I can I like to do so.  :)

After re-reading our posts I wanted to add a little more emphasis that while it is possible to override the default profile it should be done carefully or else you are likely going to really do some damage.

Let's say for example you backup a "system" directory such as /usr/share.  Then a few months go by and some packages that have installed data to /usr/share get updated.  Now when you use TKLBAM to restore or migrate your server it will install the updated packages and then overwrite the updated /usr/share data with the data from your backup. 

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)