create a backup of an online server
Hi, I want to backup our mailserver(4.7) in production. I read : http://www.openbsd.org/faq/faq10.html#DupFS Can i do this wd1(my backup disk) : mount /dev/wd1a /mnt dump -0auf /mnt/etc_backup /dev/wd0a ... same for wd0d and wd0e ... Or do i need absolutely to do it in Single User? Or perhaps, there's a better way to do it. Thank you very much. Wesley.
Re: create a backup of an online server
On Wed, 28 Dec 2011 10:06:14 +0400 "Wesley M." wrote: > Hi, > I want to backup our mailserver(4.7) in production. > I read : > http://www.openbsd.org/faq/faq10.html#DupFS > > Can i do this wd1(my backup > disk) : > > mount /dev/wd1a /mnt > dump -0auf /mnt/etc_backup /dev/wd0a > ... > same > for wd0d and wd0e ... Or do i need absolutely to do it in Single > User? > > Or > perhaps, there's a better way to do it. Personaly I found a way for myself to produce a consistent backups: 1. have an additional filesystem /backup 2. mount /backup 3. sync your changed files to /backup (I usually do this with rsync, YMMV) 4. umount /backup 5. mount /your_backup_media 6. dump -0auf /your_backup_media /dev/ However it need some preparation done beforehand, preferably on system install. this way you will be able to dump live filesystems without having to reboot your server. -- With best regards, Gregory Edigarov
Re: create a backup of an online server
On Wed, Dec 28, 2011 at 8:51 AM, Gregory Edigarov wrote: > On Wed, 28 Dec 2011 10:06:14 +0400 > "Wesley M." wrote: > >> Hi, >> I want to backup our mailserver(4.7) in production. >> I read : >> http://www.openbsd.org/faq/faq10.html#DupFS >> >> Can i do this wd1(my backup >> disk) : >> >> mount /dev/wd1a /mnt >> dump -0auf /mnt/etc_backup /dev/wd0a >> ... >> same >> for wd0d and wd0e ... Or do i need absolutely to do it in Single >> User? >> >> Or >> perhaps, there's a better way to do it. > > Personaly I found a way for myself to produce a consistent backups: > 1. have an additional filesystem /backup > 2. mount /backup > 3. sync your changed files to /backup (I usually do this with rsync, > YMMV) > 4. umount /backup > 5. mount /your_backup_media > 6. dump -0auf /your_backup_media /dev/ > > However it need some preparation done beforehand, preferably on system > install. > > this way you will be able to dump live filesystems without having to > reboot your server. > > -- > With best regards, > B B B B Gregory Edigarov > Wouldn't you consider AMANDA http://www.amanda.org I had been using it for long in my previous support engineering life. It's nice. -- ### Coonardoo - PQP8P=P8QP:P0 Q QQP=Q / The Well In The Shadow / Le Puits Dans L'Ombre ###
Re: create a backup of an online server
On Wed, 28 Dec 2011, Wesley M. wrote: > Hi, > I want to backup our mailserver(4.7) in production. > I read : > http://www.openbsd.org/faq/faq10.html#DupFS > Much simpler to: > Do a mysqldump and direct to a known backup location > Use rsnapshot to backup all of your data (including the email system, home, and the mysqlbackup) mysqldump will provide a 'known state' of the database, which will make a restore possible; backing up files will only work if you shut down mysql during the backup process - something not realistic for a production server. Lee
Re: create a backup of an online server
On 2011-12-28, L. V. Lammert wrote: > mysqldump will provide a 'known state' of the database, which will make a > restore possible; backing up files will only work if you shut down mysql > during the backup process - something not realistic for a production > server. see mysqlhotcopy(1). there are + and - points for each method though.
Re: create a backup of an online server
As always...you design your backup for your application. Mail servers are particularly tricky, as the data the contain tends to change minute-by-minute, and they are prone to both hardware failure, administrator error AND user error. A user who nukes their mail store will want their data restored, but the other ten thousand users will NOT want their mail store rolled back 24 hours (or whatever your backup interval is). Dumps aren't so good at dealing with that. For a POP mail server, daily backups of the mailstore are almost useless...you restore data that's already been retrieved, you don't restore data that wasn't retrieved. For IMAP servers using a Maildir storage system, backup is relatively straight forward -- rsync does wonders. But, understand how your system works. Maildir is very slick for this -- generally, a file exists in a maildir, or it doesn't...once it exists, it generally isn't supposed to change (though it may be deleted). This is screaming "rsync!". However, backing up an IMAP mail store daily leaves a lot to be desired. Most likely time for someone to accidentally delete the important mail they have been waiting for is probably not too long after it arrives. Depending (mostly) on the number of messages in your mail store, you may be able to run an rsync of the maildir hourly or maybe even every 15 minutes to another local hard disk. You could make that rsync cumulative -- no removing of deleted files, then daily rsync that backup off to another machine (using --link-dest option for a quick, rotated backup), and then doing an rsync WITH deletion to your local system, so your backup store doesn't grow without bound. Note that with this strategy, you will end up restoring deleted e-mails and duplicating sorted e-mails. Imperfect, but overall, more annoying than harmful. If your IMAP server keeps a local index, you will need to "fix" that after a restore. You may need to lay a beating on the local indexes of your IMAP clients, too. Again, you really have to understand your task here and the tools you are using. This isn't a "How To" kinda thing, this is an "Understand. Then do" thing. Having any form of backup without knowing how to USE it to deal with real-life disasters is useless. If your e-mail server has an SQL database associated with it, you will have to know how to manage that in conjunction with the IMAP files. This can get ugly fast. Alsowith e-mail, look at the legal issues of backups. You generally don't want years worth of backups in many countries, as they could be fodder for a lawyer's "discovery" expeditions. Whatever you do for backup should be clearly documented, i.e., "We backup one week's worth of data", and it should be documented BEFORE the lawyers come knocking. This is a good place for using a second computer as the backup device, so you always know where all your backups are...rather than tapes, where a five year old tape that fell behind a desk could come back to haunt you later. And, it's all useless unless you know you can restore it, so practice... odds are, you will learn something. Nick. On 12/28/2011 01:06 AM, Wesley M. wrote: Hi, I want to backup our mailserver(4.7) in production. I read : http://www.openbsd.org/faq/faq10.html#DupFS Can i do this wd1(my backup disk) : mount /dev/wd1a /mnt dump -0auf /mnt/etc_backup /dev/wd0a ... same for wd0d and wd0e ... Or do i need absolutely to do it in Single User? Or perhaps, there's a better way to do it. Thank you very much. Wesley.
Re: create a backup of an online server
On Wed, Dec 28, 2011 at 11:00:52AM -0500, Nick Holland wrote: > However, backing up an IMAP mail store daily leaves a lot to be > desired. Most likely time for someone to accidentally delete the > important mail they have been waiting for is probably not too long > after it arrives. Depending (mostly) on the number of messages in > your mail store, you may be able to run an rsync of the maildir > hourly or maybe even every 15 minutes to another local hard disk. > You could make that rsync cumulative -- no removing of deleted > files, then daily rsync that backup off to another machine (using > --link-dest option for a quick, rotated backup), and then doing an > rsync WITH deletion to your local system, so your backup store > doesn't grow without bound. This sounds like a job for rsnapshot: essentailly point-in-time snapshots on top of rsync, using hard links of unchanged files for space and speed. With some additional shell scripting + cron you could have a really nice scheme to keep 15 minute snaps for the last few days, then daily for a while, then weekly. -- http://code.phxbsd.com/
Re: create a backup of an online server
In fact, -1- i want to copy the mail server system to another machine. I suppose rsnaphot or a dump/restore in single user? is a good choice... -2- And keep emails synchronized between the 2 mail server using rsync, this step is ok. Thank you very much for all your replies. Cheers, Wesley. On Wed, 28 Dec 2011 09:30:11 -0700, Darrin Chandler wrote: > On Wed, Dec 28, 2011 at 11:00:52AM -0500, Nick Holland wrote: >> However, backing up an IMAP mail store daily leaves a lot to be >> desired. Most likely time for someone to accidentally delete the >> important mail they have been waiting for is probably not too long >> after it arrives. Depending (mostly) on the number of messages in >> your mail store, you may be able to run an rsync of the maildir >> hourly or maybe even every 15 minutes to another local hard disk. >> You could make that rsync cumulative -- no removing of deleted >> files, then daily rsync that backup off to another machine (using >> --link-dest option for a quick, rotated backup), and then doing an >> rsync WITH deletion to your local system, so your backup store >> doesn't grow without bound. > > This sounds like a job for rsnapshot: essentailly point-in-time > snapshots on top of rsync, using hard links of unchanged files for space > and speed. With some additional shell scripting + cron you could have a > really nice scheme to keep 15 minute snaps for the last few days, then > daily for a while, then weekly.
Re: create a backup of an online server
On 12/28/2011 11:30 AM, Darrin Chandler wrote: This sounds like a job for rsnapshot: essentailly point-in-time snapshots on top of rsync, using hard links of unchanged files for space and speed. With some additional shell scripting + cron you could have a really nice scheme to keep 15 minute snaps for the last few days, then daily for a while, then weekly. this is what the --link-dest option of rsync does -- hard links of unchanged files to a new directory. Very sweet feature. There are probably a dozen "projects" which were obsoleted by the addition of the --link-dest option... Nick.
Re: create a backup of an online server
You were using Dovecot weren't you? If you're more interested in protecting against server problems than end-user error you might look into http://wiki2.dovecot.org/Tools/Dsync On 2011-12-28, Wesley M. wrote: > In fact, > -1- i want to copy the mail server system to another machine. I suppose > rsnaphot > or a dump/restore in single user? is a good choice... > > -2- And keep emails synchronized between the 2 mail server using rsync, > this step is ok. > > Thank you very much for all your replies. > > Cheers, > > Wesley. > > On Wed, 28 Dec 2011 09:30:11 -0700, Darrin Chandler > wrote: >> On Wed, Dec 28, 2011 at 11:00:52AM -0500, Nick Holland wrote: >>> However, backing up an IMAP mail store daily leaves a lot to be >>> desired. Most likely time for someone to accidentally delete the >>> important mail they have been waiting for is probably not too long >>> after it arrives. Depending (mostly) on the number of messages in >>> your mail store, you may be able to run an rsync of the maildir >>> hourly or maybe even every 15 minutes to another local hard disk. >>> You could make that rsync cumulative -- no removing of deleted >>> files, then daily rsync that backup off to another machine (using >>> --link-dest option for a quick, rotated backup), and then doing an >>> rsync WITH deletion to your local system, so your backup store >>> doesn't grow without bound. >> >> This sounds like a job for rsnapshot: essentailly point-in-time >> snapshots on top of rsync, using hard links of unchanged files for space >> and speed. With some additional shell scripting + cron you could have a >> really nice scheme to keep 15 minute snaps for the last few days, then >> daily for a while, then weekly. I would advise a bit of caution if you're thinking of using big hardlink trees on filesystems which have softdep enabled. No concrete reason I can point to, but this is at least likely to be hard on the system.. (personally I don't use softdep much).
Re: create a backup of an online server
On Wed, 28 Dec 2011 08:59:40 +0100 Vitali wrote: > Wouldn't you consider AMANDA http://www.amanda.org > I had been using it for long in my previous support engineering life. > It's nice. Yeah, AMANDA is great, but seems to be an overkill when you just need to backup one or 2 servers, or your changes are minimal. -- With best regards, Gregory Edigarov