4

I am performing regular backups of my store, however, when I navigate to /var/backups/, I don't see the backup files. I only see the old backups from a month ago (and earlier) in the backups directory.

When I perform a backup, the backup shows in the admin (System > Tools > Backups). I do not see the older backups that I see in the /var/backups folder.

Did Magento change the location of the storage for these physical backups (perhaps with a new security patch)? Where can I see what the path is? I want to copy it to my network as a plan B.

I am using Magento 1.9.1.

| improve this question | | | | |
3

the folder has always been var/backups.
See the method Mage_Backup_Helper_Data::getBackupsDir()

public function getBackupsDir()
{
    return Mage::getBaseDir('var') . DS . 'backups';
}

it's there in 1.9 and it has been there since the backup module was introduced.

Make sure the folder is writeable and you have enough disk space.

[EDIT]
I was half right in my original answer.
I assumed that Mage::getBaseDir('var') always returns MAGENTO_ROOT/var but that's not always true.
Take a look at the method: Mage_Core_Model_Config_Options::getVarDir() (this is called when determining the var dir).

public function getVarDir()
{
    //$dir = $this->getDataSetDefault('var_dir', $this->getBaseDir().DS.'var');
    $dir = isset($this->_data['var_dir']) ? $this->_data['var_dir']
        : $this->_data['base_dir'] . DS . self::VAR_DIRECTORY;
    if (!$this->createDirIfNotExists($dir)) {
        $dir = $this->getSysTmpDir().DS.'magento'.DS.'var';
        if (!$this->createDirIfNotExists($dir)) {
            throw new Mage_Core_Exception('Unable to find writable var_dir');
        }
    }
    return $dir;
}

If the var folder cannot be created magento uses as var dir the system tmp folder and creates magento/var inside it.
So for linux that should be /tmp/magento/var.
Take a look in there, maybe you will find your missing backups.

| improve this answer | | | | |
  • I didn't get a writable error from the admin when performing the backup which I usually get if there's a permission problem. – NotJay Aug 24 '15 at 14:17
  • Also, plenty of disk space. – NotJay Aug 24 '15 at 14:17
  • 1
    Could be a permission issue after all. I viewed the permissions of the folder and it said that Apache is the owner so I am going to have IT fix that form me so I can make sure that the permissions are writable. Weird that there wasn't an error message about that and it takes the normal amount of time to build a backup. Also strange that the backups appear in the admin. Thanks! – NotJay Aug 24 '15 at 14:32
  • @NotJay. Your comment made me dig deeper. See my updated answer. This should clear the fog for "the backups appear in the admin" (I hope). – Marius Aug 24 '15 at 14:38
  • /var/tmp/ is empty. – NotJay Aug 24 '15 at 14:45
4

It may be that Magento doesn't have write permissions to your var/ directory and uses system temp directory instead.

Look on Mage_Core_Model_Config_Options::getVarDir() method implementation. If Magento uses system tmp directory as fallback, your backups can be created in /tmp/magento/var/backups/ directory.

| improve this answer | | | | |
  • 1
    Ha. Just realized this now myself. :) – Marius Aug 24 '15 at 14:39
  • Yeah, this is first place to look in such case :-) – Wojtek Naruniec Aug 24 '15 at 14:41
  • tmp is empty :-/ – NotJay Aug 24 '15 at 14:47
  • Maybe try to dump Mage::getBaseDir('var') . DS . 'backups' somewhere to check which path it uses. – Wojtek Naruniec Aug 24 '15 at 14:52
  • System temp is the one you find in the root directory => / and therefore /tmp. Welcome to the *nix filesystem where duplication is done on per user, per process, etc. Many var's and tmp's, depends on context. – Fiasco Labs Aug 24 '15 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.