How to backup ?
How to backup ?
Hi,
We are using the hmailserver Version 5.3.3-B1879 and i read allover the forum about the built-in backup that only support up to ~1GB of size on the .zip but i cannot find anywhere how to properly backup after you reach the limit.
I have the configuration in .xml so that it is covered, so what happens with the database that contain the actual emails.
What is the proper method of a full backup so in a disaster i can restore it on a different machine and have everything working as normal.
I will appreciate a guideline on this.
thank you.
Vassilis
We are using the hmailserver Version 5.3.3-B1879 and i read allover the forum about the built-in backup that only support up to ~1GB of size on the .zip but i cannot find anywhere how to properly backup after you reach the limit.
I have the configuration in .xml so that it is covered, so what happens with the database that contain the actual emails.
What is the proper method of a full backup so in a disaster i can restore it on a different machine and have everything working as normal.
I will appreciate a guideline on this.
thank you.
Vassilis
Re: How to backup ?
The emails are not stored in the database, they are stored in the data directory.Vassilis wrote:so what happens with the database that contain the actual emails.
For disaster recovery, Backup the database contents, the data directory and the hmailserver.ini file. Check the docs for details on how to gain access to builtin database if you are using it.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ
Re: How to backup ?
can you point me to the docs you are referring.
I'm using Database MSSQL CE according to the application.
I'm using Database MSSQL CE according to the application.
Re: How to backup ?
If at first you don't succeed, bomb disposal probably isn't for you! ヅ
-
- Senior user
- Posts: 309
- Joined: 2009-07-21 12:33
Re: How to backup ?
If it helps, I have my hMailServer on a nightly backup which deals with both the emails themselves and the SQL database running in the background. You would need to change any relevent parts for your own setup, but mine looks like this:
I have a subfolder within the hMail installation, the path of which is 'E:\hMailServer\Emails'.
This folder contains three files: 7za.exe (the command-line version of the free 7zip archive program), backup.bat (a custome written batch file that triggers the backup) and BackupScript.sql (a custom SQL script that backs up the database).
A Windows Scheduled Task kicks everything off automatically by running backup.bat each night at 8pm.
Backup.bat contains the following code
Lines 1 and 2 delete yesterday's backup data from the local drive, ready for the new. Lines 3, 5, 6 and 8 are used to inject data about the backup into a text file. I use this text file to monitor that the backup was successful, and also to keep an eye on how long the backup takes each night. Line 9 is the textfile being copied over to my roaming profile in the server, so when I come in in the morning the log is waiting for me. Line 10 just cleans the log after I'm done.
The two lines that are the meat of the process are 4 and 7. Line 4 calls an SQL script I've written that contains the following code:
Here, a backup is made of my database (called 'MailBox'). It is automatically created as a .bak file in the same folder as backup.bat.
That's the database taken care of, now line 7 of backup.bat handles the actual emails. Because of the sheer amount and size, I compress mine using the command-line automated version of the free 7zip archive utility.
As you can see, the whole data folder is compressed, and the file gets put into the same folder as backup.bat.
Finally, I have other backup procedures running independently that go into my mailserver machine (called VAULT) and grab the database backup and the 7zip archive that were created and copies them to dedicated backup drives.
By this process, my whole hMail system gets backed up every night, taking about five hours.
Hope this helps.
I have a subfolder within the hMail installation, the path of which is 'E:\hMailServer\Emails'.
This folder contains three files: 7za.exe (the command-line version of the free 7zip archive program), backup.bat (a custome written batch file that triggers the backup) and BackupScript.sql (a custom SQL script that backs up the database).
A Windows Scheduled Task kicks everything off automatically by running backup.bat each night at 8pm.
Backup.bat contains the following code
Code: Select all
del /f /q *.bak
del /f /q emails.7z
echo %Date%, %Time%, Start Database >> E:\hMailServer\Emails\emailbackup.txt
sqlcmd -S VAULT\SQLEXPRESS -u -i E:\hMailServer\Emails\BackupScript.sql
echo %Date%, %Time%, End Database >> E:\hMailServer\Emails\emailbackup.txt
echo %Date%, %Time%, Start Emails >> E:\hMailServer\Emails\emailbackup.txt
7za.exe a emails.7z "E:\hMailServer\Data"
echo %Date%, %Time%, End Emails >> E:\hMailServer\Emails\emailbackup.txt
xcopy "E:\hMailServer\Emails\emailbackup.txt" "\\10.0.1.80\redirects$\<MY-REAL-NAME>\Desktop\Logs" /C /O /Y
del /f /q emailbackup.txt
The two lines that are the meat of the process are 4 and 7. Line 4 calls an SQL script I've written that contains the following code:
Code: Select all
DECLARE @Path NVARCHAR(1000), @FileName NVARCHAR(255), @FullPath NVARCHAR(1255)
SET @Path = 'E:\hMailServer\Emails\'
SET @FileName = 'MailBox_' + REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), '/', '') + '.bak'
SET @FullPath = @Path + @FileName
BACKUP DATABASE MailBox
TO DISK = @FullPath
WITH INIT
That's the database taken care of, now line 7 of backup.bat handles the actual emails. Because of the sheer amount and size, I compress mine using the command-line automated version of the free 7zip archive utility.
As you can see, the whole data folder is compressed, and the file gets put into the same folder as backup.bat.
Finally, I have other backup procedures running independently that go into my mailserver machine (called VAULT) and grab the database backup and the 7zip archive that were created and copies them to dedicated backup drives.
By this process, my whole hMail system gets backed up every night, taking about five hours.
Hope this helps.
Re: How to backup ?
nice one Tezcatlipoca, many thanks i will definitely take a look at that.
Re: How to backup ?
thanks Tezcatlipoca, ur bat file etc really helped and currently im using this method and works perfect, one note though, if any1 using mysql, then u can use the mysql administrator to create schedule task to backup the hmaislerver DB only, files need to be backed up using the bat file and zip method.
-
- Banned
- Posts: 95
- Joined: 2007-12-30 13:57
Re: How to backup ?
I've done the same. But in my opinion it's not "good".Tezcatlipoca wrote:If it helps, I have my hMailServer on a nightly backup which deals with both the emails themselves and the SQL database running in the background. You would need to change any relevent parts for your own setup, but mine looks like this:
I have a subfolder within the hMail installation, the path of which is 'E:\hMailServer\Emails'.
This folder contains three files: 7za.exe (the command-line version of the free 7zip archive program), backup.bat (a custome written batch file that triggers the backup) and BackupScript.sql (a custom SQL script that backs up the database).
A Windows Scheduled Task kicks everything off automatically by running backup.bat each night at 8pm.
There are inconsistencies when you backup the database and then backup the mails when you get more mails after you did the the sql backup.
I'm working on a script with uses VSS to get everything in a consistent state and backup from this snapshot.
Re: How to backup ?
yes im aware of it but it does the job on servers with fewer mailboxes so chances r even if mails come in and out u might have more files than DB entries but that will be of concern only when ur in a situation where u need to restore from backup. another thing that could be done on smaller installation is to switch hmail off, then backup and then start it.
-
- Banned
- Posts: 95
- Joined: 2007-12-30 13:57
Re: How to backup ?
I have only about 50 accounts but 50gb to backup. This takes a while.
Re: How to backup ?
Why don't you use something like Ghostfiles to keep the data directory mirrored in a backup location, then stop the Ghostfiles service in your script, Zip the secondary data directory with the database dump, move the zip wherever, then re-enable Ghostfiles service, that way you will always have a snapshot and you never need to disable hMail at all.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ
Re: How to backup ?
personally, i would prefer a more robust backup and restore feature in hmail itself coz i rent a lot of servers so its not feasible for me to buy the software for all servers and mayb if hmail had a feature such that when in backup progress mode, it continues to accept mails but doesnt copy to data directory or the DB untill the backup is complete that way it can be consistent.
also most of my servers r with 2 HDD's mirrored for HDD failure and a ftp backup for each server so that other software doesn't sync with ftp locations etc and all of the servers have a handful of accounts but use up almost 30GB of space in emails.
also most of my servers r with 2 HDD's mirrored for HDD failure and a ftp backup for each server so that other software doesn't sync with ftp locations etc and all of the servers have a handful of accounts but use up almost 30GB of space in emails.
Re: How to backup ?
Feel free to add what you need to 5.4 source
If at first you don't succeed, bomb disposal probably isn't for you! ヅ
Re: How to backup ?
^DooM^ wrote:Feel free to add what you need to 5.4 source
only if i hadn't stopped programming so long ago

i can donate along with others if there was a bounty section similar to that in pfsense where u can pay and get features added provided any of the developers were willing to take it up
Re: How to backup ?
I've created a batch file which (it works only with Server 2008/2008 R2)
1) stops hMailServer (in case you use the integrated MSSQL/MYSQL db)
2) creates a shadow copy
3) starts hMailServer
4) backups complete hMailServer folder (excluding logs) with 7zip
I can post the scripts if you are interessted.
1) stops hMailServer (in case you use the integrated MSSQL/MYSQL db)
2) creates a shadow copy
3) starts hMailServer
4) backups complete hMailServer folder (excluding logs) with 7zip
I can post the scripts if you are interessted.
Re: How to backup ?
Yes Kelden, please post it.
Re: How to backup ?
Here is the current version I use. It's very basic atm and only does the job when
everything is correctly set up.
I've setup a google code page to improve it
http://code.google.com/p/hmailserver-ba ... loads/list
extract it in any folder you want.
a) you need a folder C:\Backup
create it first or change it in the batch file. It's not automatically created yet.
b) start backup_hMailServer.cmd to start a backup
perhaps you have to change the PRETTY_DATE variable
backup_hMailServer.cmd stops hMailServer and calls diskshadow.script
diskshadow.script does all the work for creating a shadow copy and assigning a drive letter.
diskshadow.script executes ___hMailserver_backup.cmd which does the real job.
TODO:
- automatically create C:\Backup if it doesn't exist
- better names for scripts
- backup real Database instead of the integrated one
- better date format independent of current date format
You can post any whishes and I will try to upgrade it soon.
everything is correctly set up.
I've setup a google code page to improve it
http://code.google.com/p/hmailserver-ba ... loads/list
extract it in any folder you want.
a) you need a folder C:\Backup
create it first or change it in the batch file. It's not automatically created yet.
b) start backup_hMailServer.cmd to start a backup
perhaps you have to change the PRETTY_DATE variable
backup_hMailServer.cmd stops hMailServer and calls diskshadow.script
diskshadow.script does all the work for creating a shadow copy and assigning a drive letter.
diskshadow.script executes ___hMailserver_backup.cmd which does the real job.
TODO:
- automatically create C:\Backup if it doesn't exist
- better names for scripts
- backup real Database instead of the integrated one
- better date format independent of current date format
You can post any whishes and I will try to upgrade it soon.
Re: How to backup ?
I am getting this message
C:\backup1>diskshadow -s diskshadow.script
'diskshadow' is not recognized as an internal or external com
operable program or batch file.
Starting hMailServer
I have a c:\backup and I am runnning the script from c:\backup1 and it is in the path and shadow server is enabled
This is on a windows 2003 server
Thanks
C:\backup1>diskshadow -s diskshadow.script
'diskshadow' is not recognized as an internal or external com
operable program or batch file.
Starting hMailServer
I have a c:\backup and I am runnning the script from c:\backup1 and it is in the path and shadow server is enabled
This is on a windows 2003 server
Thanks
Re: How to backup ?
Kelden wrote:I've created a batch file which (it works only with Server 2008/2008 R2)
If at first you don't succeed, bomb disposal probably isn't for you! ヅ
Re: How to backup ?
Still trying to figure out how to create a shadow copy on Server 2003
Re: How to backup ?
I've created a new version I'm currently testing on my server with full backup once a week and incremental backups else.
This will reduce the backup size significantly and it's optional if you don't like it. If it's working well, I will post an update the next days.
This will reduce the backup size significantly and it's optional if you don't like it. If it's working well, I will post an update the next days.
Re: How to backup ?
Is there a way to "pause" the server from receiveing emails without shutting it down? or stop the pop service?
Re: How to backup ?
Using the stop button in the GUI really only 'pauses' the server, but all protocols, SMTP + POP3 [+IMAP]
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation
https://www.hmailserver.com/documentation
-
- New user
- Posts: 26
- Joined: 2008-12-16 13:57
Re: How to backup ?
Kelden,
To create a shadow copy via script in server 2003 use vshadow.exe from the resource kit
To create a shadow copy via script in server 2003 use vshadow.exe from the resource kit
Re: How to backup ?
Updated to v0.2
I've added incremental backups.
http://code.google.com/p/hmailserver-ba ... loads/list
I've added incremental backups.
http://code.google.com/p/hmailserver-ba ... loads/list