Backups (MOST IMPORTANT)

Dear guys, hi!

I have almost finished the system set up!

I have most important ticket support out of all - it's Backups!

Let me tell you of my file system configuration.

I have RAID 10 out of 4 HDD drives 4TB drives each.

Then I have 2 SSDs for system, swap and databases each 300 GB!

I created 2 x 300GB partitions on my RAID for the purpose of backing up my system data from SSDs!

Now I would like you to help me with the advice or a guide, of what would be the BEST way to make COMPLETE system disk backup (meaning SSD1 to -> 1 partition and SSD2 -> to the second partition on my RAID10).

The best way I would like to have COMPLETE IMAGE (that would be easily recoverable) every 24-48 hours. For example in case my system SSD dies I would quickly like to reboot my system via IPKVM and set my backup partition to be booted from!

Please help me - for me it's number one ticket!

What backup system do you recommend? What is the best one out there? I saw Bacula backup module? Is it good (the best) to use? it's the one you'd install by yum install *bacula*? It loads a lot of dependencies? (around 46 mb).

Please help me out with this, the best you can!

Best wishes, Ilia

Status: 
Active

Comments

Howdy -- we unfortunately don't have a recommendation on a backup tool that generates complete system images. There's a lot of them out there, though that's not something that Virtualmin itself can do.

We're happy to provide advice on the Virtualmin backup functionality though -- that will generate backups of all data related to Virtual Servers.

For folks who need to be able to get online as quickly as possible in case of a serious failure, most would have a second server that acts as a hot spare. That hot spare would be running Virtualmin. They would send the backups from the primary server to that backup server every night, and restore the backups.

Then, if something ever happens to the primary, the hot spare would be activated to take the place of the failed server.

However, if your goal is to generate system images on a disk attached to your current server -- that's unfortunately not our area of expertise, so we're not able to make a recommendation as to which products might work best for you.

Ilia's picture
Submitted by Ilia on Sun, 03/24/2013 - 16:40

I see! Well I try to figure out all of it myself! :)

But you didn't say anything about Bacula module that you have for Webmin? Is it up-to-date? Is Bacula good backup system? Does it do full system backups?

Webmin does indeed have a Bacula module, which some users use. It was contributed by a third party. We're unfortunately not too familiar with Bacula's featureset though, and it's not what we use personally (we use Virtualmin's own backup in the Backup and Restore section).

Bacula does have a section in it's documentation that describes it's disaster recovery options... we'd suggest reviewing that to determine if Bacula would work well for you:

http://www.bacula.org/en/dev-manual/main/main/Disaster_Recovery_Using_Ba...

Ilia's picture
Submitted by Ilia on Tue, 03/26/2013 - 06:35

I just read more about inbuilt Webmin Filesystem Backup function?

It seems it can do full system backup (dumb), correct? If so I could make a dump to some drive, like sde2 and then load from it if needed??

Why you didn't offer it as a solution? Will it serve the purpose well referring to the initial question above?

Have a great day, Ilia

Well, backing up all files as the Webmin File System backup can do, and generating a system image as you were asking about, are different types of backups.

The Webmin Filesystem Backup can indeed backup files, but it's not designed for bare metal disaster recovery.

It won't generate a boot sector, or create any of your partitions -- you would need to manually set those up on your backup drive in order for it to boot.

Also, the Webmin Filesystem Backup isn't able to backup MySQL and Postgres databases. You would need to use a different tool in order to generate a backup of your databases, or you could stop the database during the backup process.

One way you could generate a database backup is to use the Virtualmin backup, but configure it to only backup databases. You can disable most other backup features, such as the home directory backup.

Then, once you've booted onto your new drive, you could restore all the databases.

I would highly suggest testing your backup process, including booting into it, to make sure it's working as expected.

Ilia's picture
Submitted by Ilia on Tue, 03/26/2013 - 09:33

Thanks for your reply which gave me an idea, look:

  1. let's say I create partitions manually

  2. then I setup filesystem backups to backup to each partition individually

  3. then I edit fstab to properly map drives on boot

  4. then I write boot sector manually once and that's it?

I didn't understand about database backups, only Virtualmin can make them? why?

Thanks for your reply which gave me an idea

The steps you outlined above can work. I'd just recommend testing it all first to make sure it's working as expected :-)

The one other issue though is the databases --

I didn't understand about database backups, only Virtualmin can make them? why?

It's not that only Virtualmin can make them... it's that in order to backup MySQL or Postgres databases, you need to use a MySQL or Postgres tool to do so. And Virtualmin uses those tools.

The reason for this is that the database files are held open by the MySQL/Postgres process, and not all data is immediately written to disk.

Just copying the database files themselves will lead to an inconsistent, and often corrupt, backup.

To avoid that, it's necessary to use tools provided by MySQL and Postgres to generate backups of the database contents if MySQL and Postgres are currently running.

You could do that manually -- for example, MySQL provides the "mysqldump" tool to generate database backups. However, if you use Virtualmin to generate your backups, it handles all the hard stuff for you, and calls mysqldump on it's own while generating backups.

Alternatively, if you want to be able to copy the database files themselves, you can stop MySQL/Postgres first. If MySQL/Postgres aren't running, it's no problem to copy the database files.

Ilia's picture
Submitted by Ilia on Tue, 03/26/2013 - 10:07

Awesome!! :-)

  1. Does Virtualmin uses mysqldump that is distributed with mysql rpm?

  2. will devices (hard drives) be named the same way if I don't change their physical/port location, meaning if I see the drive as sda now, will it be named the same if the boot drive changes? does naming tie to the ports on motherboard or randomly selected upon installation?

  3. what is the best known way to copy boot sector from one drive to the other, what a command would look like?

  4. is boot sector rewritten upon kernel updates or it could be written once?

thanks a lot!

Sincerely, Ilia

Does Virtualmin uses mysqldump that is distributed with mysql rpm?

By default, Virtualmin uses the mysqldump version located in /usr/bin. That's normally the one included by the distribution vendor.

will devices (hard drives) be named the same way if I don't change their physical/port location, meaning if I see the drive as sda now, will it be named the same if the boot drive changes? does naming tie to the ports on motherboard or randomly selected upon installation?

Not necessarily :-)

Changing the hard drive port can change the device names. Also, removing an active hard drive and rebooting could change the name of the secondary drive as well.

You could setup the devices in /etc/fstab to mount via UUID, rather than using device names.

Setting that up is a bit outside the scope of what we can help with in Virtualmin support, but you can read RedHat's documenation on that here:

https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/...

what is the best known way to copy boot sector from one drive to the other, what a command would look like?

Sorry, I'm not sure of the best way to do that, and that's not something that can be done from within Virtualmin.

Creating boot sectors can be complex, and requires testing :-)

is boot sector rewritten upon kernel updates or it could be written once?

That's up to the distribution vendor, as well as the boot loader being used. It's possible it could be rewritten during certain updates.

Ilia's picture
Submitted by Ilia on Wed, 03/27/2013 - 13:06

Setting partition as BOOT with parted command and then placing (backing up) files with filesystem backup from original /boot to backup /boot will make it bootable? Or settings partition as boot with parted doesn't write any boot sectors on it?

Ilia's picture
Submitted by Ilia on Wed, 03/27/2013 - 13:24

And one more question:

When I do filesystem dump as "EXT4 filesystem dump" I can't exclude directories?

How to exclude /home from the dump?

Regarding the filesystem dump -- that backup option unfortunately doesn't have a way to exclude files If you wish to exclude files, you would need to use a tar backup, by checking the "In TAR format" checkbox when creating the backup.

Alternatively, if you wish to use the dump format backups -- you could create several backups, one for each root level directory except /home, since the dump backup does allow you to select which directory to backup.

Regarding setting up a bootable backup drive -- if you're hoping to use a secondary drive as a bootable backup, you may need to work with a sysadmin who can assist you with that process, and help you make sure the backup is working properly. It's also possible that someone in the forums may have tried that, and could be capable of guiding you through that process.

It's a bit outside the scope of what we can assist with in Virtualmin Support though -- and isn't normally how we'd recommend performing backups (due to the complexity involved).

However, parted doesn't normally generate a boot sector capable of booting your kernels.. boot sector tools such as grub would do that.

Ilia's picture
Submitted by Ilia on Wed, 03/27/2013 - 13:55

OK, thank you very much for your help!

Ilia's picture
Submitted by Ilia on Thu, 03/28/2013 - 05:37

EDITED:

Done it already!! :)

I'm trying to add Webmin backups to my already backed up folder created with Virtualmin in the way /backups/%Y-%m-%d.

How do I use the same format with Webmin Scheduled backup module?

I want Webmin to put its backups to the same directory: /backups/%Y-%m-%d/webmin.tar.gz?

Ilia's picture
Submitted by Ilia on Thu, 03/28/2013 - 05:50

My second question: After I create Filesystem Backup with Webmin I have just a file, let's say dump laying in my /backup/etc/dump? How do I extract it just to the same directory, so it would make it just the same as my current files one /etc just in case I need to reboot and start my system from a backed up drive. I'd like everything to be ready?

Am I going to the correct direction with my idea of backing up my server?

Idea is: to use Filebackup Module to create a dump to a disk that I could load from later? Just like I was describing above?

EDITED: Do I have to back up /sys? Or it's like /proc /tmp /lost+found and /dev?

EDITED 2: I think restore command will restore it to the original palace? restore -x -f '/backup/Maildir/dump-2013-03-28' -u How to restore it to the same directory where the backup resides??

I want Webmin to put its backups to the same directory: /backups/%Y-%m-%d/webmin.tar.gz?

It sounds like you got that working, that's great!

Am I going to the correct direction with my idea of backing up my server?

Well, there's many ways to perform backups.

Although what you're doing isn't our recommended way of performing backups, it's capable of working... it just requires lots planning and testing :-)

Do I have to back up /sys? Or it's like /proc /tmp /lost+found and /dev?

You don't need to backup the contents of those directories, though you'd want to make sure the directory exists, and with the correct permissions.

I think restore command will restore it to the original palace? restore -x -f '/backup/Maildir/dump-2013-03-28' -u How to restore it to the same directory where the backup resides??

If you're going to create the various partitions on your backup disk first, you might find it simpler to use tar for backups, rather than dump. It's fairly straight forward how to specify where a tar archive should be unpacked.

Alternatively, you could also explore using "rsync" for backing up one drive to another. Rsync is good at copying files, and only copying files that changed. Webmin/Virtualmin doesn't provide a front-end for that though, you'd have to build a script to handle that from the command line.

Ilia's picture
Submitted by Ilia on Thu, 03/28/2013 - 10:06

are you saying that restore command can't extract to the defined directory? or it's possible? what would be a command flag?

tar doesn't do back ups as good as dump/restore? if it does what are the best flags to extract? is it tie same result as dump?

It really sounds like you may need to consult with a sysadmin who can assist you in setting up your backup process, since the method you're using requires a lot of manual setup outside of Webmin/Virtualmin.

Some folks in the forums may be able to help with that, for example.

The filesystem backup in Webmin was designed to be used to both generate backups, as well as restore them.

It's possible to restore those backups manually, outside of Webmin/Virtualmin, but how to do all that is outside the scope of what we can assist with here in Virtualmin Support.

Ilia's picture
Submitted by Ilia on Fri, 03/29/2013 - 12:46

Andrey, I will consult as finish trying what I'm planning to do!

Or you think I'm on the way of destroying my system? :)

After I finish with backups I will post my example on the forum and will see what public says!?

I just wanted you to help me with restore command and make sure I can just extract images to the desired directory not the default one from where it was taken?

Could you please advice or provide some links and then I would try to do it with Maildir ; )?

Or you think I'm on the way of destroying my system? :)

Well, you won't destroy your system with proper guidance, but we unfortunately can't be the ones to provide that guidance since those aren't Virtualmin questions :-)

To my knowledge, the restore command unpacks the contents of the archive into the current directory, though you'd definitely want to test that, as I only rarely use the dump and restore tools. But as I review examples on Google, it looks like the restore command restores files to the current directory.

Also, I can offer that, using tar, tar unpacks it's archive in the current directory by default, or you can specify an alternative directory with -C.

However, command line tool usage really is outside the scope of what we can help with; you'd really want to consult with a sysadmin to get assistance in how to use Linux command line tools. There are folks in the forums who can assist with that.

Ilia's picture
Submitted by Ilia on Fri, 03/29/2013 - 13:52

Thanks a lot!

But as I run restore -x -f '/backup/Maildir/dump-2013-03-28' -u it actually extracts it in to same directory + directory that it has when was dumped - it this case I happen to have Maildir directory under Maildir. The only problem that is asks silly questions and make me click but I would like to have it done without questions. Here is what it says: Unless you know which volume your file(s) are on you should start with the last volume and work towards the first. Specify next volume # (none if no more volumes):

You guys made those Filesystem backup modules? You should know how it operates? :))

Ilia's picture
Submitted by Ilia on Fri, 03/29/2013 - 14:03

OK! This one works fine restore -x -f  'dump-2013-03-29' -u -a

but asks now for:

set owner/mode for '.'? [yn]

What is this in the World?

We are thrilled to help with your Virtualmin questions!

This is a restore question though. If you have questions on how to use the dump/restore tools outside of Virtualmin, please use the Forums :-)

Ilia's picture
Submitted by Ilia on Sun, 05/26/2013 - 14:34

The steps you outlined above can work. I'd just recommend testing it all first to make sure it's working as expected :-)

OMG!! OMG! I have finally done it! It works like charm! I can choose upon boot via IP-KVM which disk to use (Do nothing for regular boot and use SSD (by default) or to use RAID (in case of SSD failure)), I choose RAID and the sytems just loads seamlessly, after you log in - it's just a mirror, with out a twitch.

So glad I could manage to make it into scheduled live working backups (though I had to create a small bunch (around 15 ) of scripts and tweaks to make it work the way it is.

Now I have scheduled - twice a week Filesystem Backup done by Webmin + my scripts that are executed after backup is done (also in Webmin) - and there you go - mirrored and fully working backup!! Awesome!! :)

I wish it was in Webmin by default!?

Anyway thanks for all you previous comments and help - it was useful!

If you interested in some details, let me know!

All the best, Ilia