Restoring Virtualmin backups - problem if Home Directory Name different to Username

When restoring a Virtual Server Backup to another server (eg backup server) the restore fails to account for the case where the home directory name (on Centos/RH: /home/homedirname) does not match the name of the user, instead only creating home directories using the username.

For example, I have home directories of the form: /home/websitename.co.uk, with usernames of the form websitename. (Where there is a name collision (.com/.co.uk) then I use a slightly different username, but these are very unusual cases, since for the most part .variations are only aliases.)

The result of the restore is that the home directory is set to /home/username, but all the configuration files (apache etc) still refer to the old pathnames, such as /home/websitename.co.uk

This means that restoration of a backup file to a backup server will not run without a number of manual changes. When several virtual servers have to be restored quickly in the event of a primary server failure, this will lead to extended downtime and troubleshooting.

Status: 
Active

Comments

That's odd, Virtualmin is supposed to take this into account already. One work-around would be to configure the target system to use the same format for home directories .. is that a possibility in your case?

The only case where I can see the directory name change causing problems is if it was changed on the old system outside of the control of Virtualmin? You could check this at Limits and Validation -> Validate Virtual Servers, by validating that domain.

Hi Jamie,

Thank you for your swift response. I'm not sure whether they were configured by hand it is possible. We imported most of them from PLESK originally and it took a while to get used to the Virtualmin way (which I now like a lot!) and to reconfigure them, because the PLESK way is (as I'm sure you well aware) rather squirly under the hood.

I will have to create some test cases where I am sure exactly what the configuration is and what the results are and get back to you.

One work-around would be to configure the target system to use the same format for home directories ..

Well I think that that is how it is configured, but now you have confirmed that this is how things are supposed to work, I will run through some thorough test cases. I clearly need to ensure that each domain is set up in a way that Virtualmin understands and it is possible that some (or all!) of them are suffering from some form of PEBKC!

I will investigate.

Thanks again, Piers

I'd recommend running that validation step that I mentioned - it will check to ensure that the home directory matches what Virtualmin thinks it should be.

Thanks Jamie, will do.

P.

Ok, let us know what you find..

OK - sorry for the delay in replying, but I had to put this on hold for a while. Anyway, here are some results!

I tried the Validation -> Validate Virtual Servers and after getting some errors I resolved these so it passed without warnings.

I then backed everything up and tried restoring them. I got this error during import:

Restore failed : No section found for mod_fcgid directives

...because the home directory name was not set as per the backed up domain, rather set to the username as described above.

What I discovered is that if I set:

Virtualmin -> System Settings -> Module Config -> Defaults for new domains -> Home subdirectory -> From template (can use $USER and $DOM) = $DOM (previously Automatic)

...then most domains, restored OK, but only because I'd forced Virtualmin to use the $DOM as the home directory name, not because it was restoring the original home directory name.

Where I had the home directory name set to a different name (due to temporary installations used for development that will later become the name used) then these failed because the home directories were set to the $DOM domain name, not the original directory name as per the installation that I'd backed up.

So it seems that Virtualmin 3.79.gpl is either:

A - not storing the original directory name and creating the new installation according to the Config

OR

B - storing the name and then ignoring it and using the setting in the Config anyway

Now it would seem to me that this is not the expected behaviour, and that the backup/restore should use the original /home/dirname when backup/restoring. I can think of no reason why this wouldn't work.

Can you please clarify what the expected behaviour is? And if this is expected behaviour (scary!) is it possible to have Use The Original Dirname as an option on restore?

Best regards, Piers

Hi,

Further to my previous post, I worked round the domain that would not import by renaming the home directory to match the domain name. The import now completes.

However, although I selected:

Restore Virtual Servers -> Other restore options -> IP address for restored servers : Original IP address

...the restore process silently set all the IP addresses to the internal (10.10.10...) IP address.

Not quite what I was expecting!

As a quick test, I created a Network Interface (not activated, since it would clash with the current live IP) and imported one of the domains that used it and it still assigned the internal 10.10.10... IP.

Is this how it's supposed to work when you import - you need to map all the IP addresses by hand? I can see that pulling in a number of backed up domains under pressure like this would be quite hard work.

Best regards,

                  Piers