Restoring domain backup

I'm working to restore a number of virtual servers backed up from one server and restoring to another server. What I do not understand is why the backups are restoring to the wrong home directory. I have /home/username instead of /home/domainname.

I changed Virtualmin Configuration > Defaults for New Domains > home directory set to $DOM.

That was changed after I noticed the first few domains being restored to the wrong location but nothing changed after I changed that value

Status: 
Active

Comments

One thing you may want to do is generate a backup of your Virtualmin settings from the first server, and restore that onto your second server.

To do that -- go into Backup and Restore -> Backup Virtual Servers -> Features and settings, set all the options in "Virtualmin settings to also backup", and then generate a new backup. As you do that, it'll create a file named "virtualmin.tar.gz" -- that will contain all the settings for your current Virtualmin server, which you can then restore onto your other server.

To shed some light, we exclude all the domains home directories from the backup (including everything else) preferring to rsync that data later. The backup was a single file.

I am guessing that because the home directory was excluded the backup had no information about what the correct path should be for any domain contained in the backup file and looked to System Settings > Virtualmin Configuration > Defaults for new domains > Home Directory to set the home path. Though I changed this during the process it had no bearing because it was a single backup to restore so all the variables were read and set when the process started.

Is that what happened? Does that sound correct?

If that is, I think that having the Home Directory set correctly before restoring the backup would fix that issue.

I'd also like to remove all the domains that were restored before we killed the process without having to remove each one, one-by-one. Is there an API command that would accomplish this?

Well, we may need Jamie to answer your first question regarding what happened during your initial restore attempt.

Now, as far as removing domains with an API command -- you can indeed do that!

You can only delete one at a time, but you could always script it. You can use a command like this to delete a domain:

virtualmin delete-domain --domain VIRTUAL_SERVER_NAME_TO_DELETE

When restoring, the home directory is adjusted to match the settings on the new system.. so what you probably want to do is delete any incorrectly restored domains, change the home directory format, then re-restore.