Problem restoring mail files from backup

Hi Guys

We’re going to be migrating to a new set of servers in the coming weeks, we’re moving from CentOS 4.x/5/x to Ubuntu. To migrate our websites, I’m hoping to simply use Virtualmin backup, then restore them on the new Ubuntu machines. But when I restore a backup, I’m getting the following error:

Re-creating mail and FTP users …
… done

Re-creating mail aliases …
… done

Restoring mail files …

Restore failed : Write failed : No such file or directory

Any thoughts on what might be causing this? Or how to diagnose it?

I’ve checked in the Syslogs and there are no error messages indicating the cause.

Howdy,

Migrating sites using backups the way you’re doing is our recommended way of moving from one server to another. You may have seen these already, but there’s a guide written for how to do all that:

https://www.virtualmin.com/documentation/system/migrate

However, that won’t help with the specific problem you’re having though, as it sounds like you’ve run into some sort of unusual issue there.

I’m going to pass along your question to Jamie to get his input on what might be going wrong there. What you’re doing should work! And hopefully we’ll get that working with Jamie’s help :slight_smile:

-Eric

This might be because the directory Virtualmin thinks mail files should be in doesn’t actually exist. For example, if /var/mail is missing or is a file or a symlink to a missing directory, you might see this error.

If you run virtualmin check-config on the new system, does it report any errors?

Hi Jamie

The check-config on the new system is reporting ok - Also I have managed to successfully restore a couple of other websites… though come to think of it, these did not really have any email accounts.

The old server that the back up was taken from had limited storage, so the home folders were placed on an NFS share, and /home/ was symlinked to /nas/accounts/.

When looking at the domain.co.uk_mail_users in the backup tar, I noticed the paths to the home directories also went to /nas/accounts, so I updated the file and ran the Restore process again, but I got the exact same error.

I wonder if this is a problem in the domain.co.uk_mail_files, does this have any paths stored in it?

Which file did you update in the 3rd paragraph?

Also, if you create the directory /nas/accounts and re-try the restore, does it work?

Hi Jamie

I updated the domain.co.uk_mail_users and replaced “/nas/accounts” path with “/home/”.

Regarding the /nas/accounts directory, Virtualmin actually created this, it also restored most of the email files to “/nas/accounts/domain/homes/”. The same thing also happened when I updated the path as described above (the path this time was /home/domain/homes/).

Given that the restore process appears to be mostly completing, the only thing I can think of is Virtualmin is running into a problem with the “domain.co.uk_mail_files” file, perhaps there is a corrupt mail file or something else.

I don’t think file corruption is likely to be issue … instead, I think the real cause is an expected parent directory for mail files is missing.

Hi Jamie

Please could you expand on what you mean with “parent directory”?
Do you one of the directories in the email directories in “/home/domain/homes/”?

Many of the Mail files are restored. so the latter might make sense, it could be freaking out as it can’t find a necessary directory.

Yes, I mean the directories above where the mail file should be written to.

Are you still getting errors when restoring email?

Yes, but most of the email directories and files are being created before the error is generated.