Magento 1.9 – Where Are My Backups?

backupmagento-1.9

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.

Best Answer

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.

Related Topic