# Backing up server...



## hockey97 (Jan 2, 2012)

I am using freebsd FreeBSD 8.1 OS on my server. I would like to know what's the best way to back up everything? I want to create a system where I can easily back up everything in a way where I can just attach my external hard drive that has a backup copy of my server. I can then easily recover.

What I mean is that I am starting my own hosting company. I need some way where I would have less down time. Let's say the server has some issues that the server or computer no longer works. I want it to be easy where I can just take my external hard drive plug it in and it will get my server back to a working condition.

I ask here what's the best way of a backup system where I can minimize time that needs to take to fix any errors. I don't actually want to spend time getting the server back to  a working condition. I want something that is instant.

Any good ideas on what I can do?


----------



## vermaden (Jan 2, 2012)

Create partitions on the external disk and make it bootable the same way Your current setup is, then leave it somewhere plugged and do a hourly/daily rsync of the whole system there (remember to stop databases for the transfer), should do the trick.


----------



## hockey97 (Jan 2, 2012)

vermaden said:
			
		

> Create partitions on the external disk and make it bootable the same way Your current setup is, then leave it somewhere plugged and do a hourly/daily rsync of the whole system there (remember to stop databases for the transfer), should do the trick.



Is there any good tutorials I could follow that could walk me though the steps?


----------



## vermaden (Jan 2, 2012)

Sure, these for example:
http://www.thegeekstuff.com/2010/09/rsync-command-examples/
http://www.thegeekstuff.com/2011/07/rsync-over-ssh-without-password/


----------



## fluca1978 (Jan 2, 2012)

I suggets to use mirrors: double (or more) disks within your system sounds to me the fastest way to survive a server problem. Keep your configuration files under a revision control system and you are done. And do an rsync to an external disk just in case of big disaster.


----------



## stuart (Jan 2, 2012)

Well the way I do it is to use ZFS (for the root filesystem and all data) and just create daily recursive snapshots of the base filesystem, and send them to your backup drive. In order to restore, you'd just run `zfs recv` on a clean disk and that'd restore your OS. 

The only other thing you'd have to do is create the GPT partition layout on the new drive in the same way as the old drive so that its bootable. You might find rsync is a better solution, but there's something quite elegant about ZFS snapshots...


----------



## gkontos (Jan 2, 2012)

hockey97 said:
			
		

> I ask here what's the best way of a backup system where I can minimize time that needs to take to fix any errors. I don't actually want to spend time getting the server back to  a working condition. I want something that is instant.
> 
> Any good ideas on what I can do???



There is no instant recovery unless you go with a HA scheme.

Full ZFS systems, with incremental snapshots can minimize your downtime. Consider also to separate your data from the OS.


----------



## fluca1978 (Jan 2, 2012)

gkontos said:
			
		

> There is no instant recovery unless you go with a HA scheme.



Agree.
But he was asking for a little downtime, not instant recovery. So I guess the minimal down time you can get is that required that to recover a backup of data/os. In such case mirroring is the way to go, I mean mirroring disk first, mirroring server second, and so on. Then you can go for HA.


----------



## gkontos (Jan 2, 2012)

fluca1978 said:
			
		

> Agree.
> But he was asking for a little downtime, not instant recovery. So I guess the minimal down time you can get is that required that to recover a backup of data/os. In such case mirroring is the way to go, I mean mirroring disk first, mirroring server second, and so on. Then you can go for HA.



I didn't suggest mirroring because I take it for granted. Although mirroring sometimes tends to create a false impression of security and peace of mind.


----------



## wblock@ (Jan 2, 2012)

It's an important distinction.  Mirroring is to protect against disk failure.  Backup is so you can restore a file that was accidentally deleted a month ago.


----------



## gkontos (Jan 2, 2012)

wblock@ said:
			
		

> It's an important distinction.  Mirroring is to protect against disk failure.  Backup is so you can restore a file that was accidentally deleted a month ago.



Or hacked, in case of a hosting company like our friend wants to do.


----------



## hockey97 (Jan 3, 2012)

Yes, I am trying to start up a hosting company. I'll be hosting websites for others. I need to have a setup system that would be best in such an environment. I want more of an automated approach. Since I am currently a college student. I am busy with other things. So if I can have a setup that would prevent any corruption or errors or loss of data. I would like such a system where there is less hands-on approach. Even if I do have to manually either remove a hard drive or maybe like the hard drives hardware is physically damage. I don't mind doing those things manually.

I just think that I should have a system so that if I am in college or else where my server won't be offline. I do own a UPS system and one server. I am new to this and the business. Yet, not new to programming. So I need help on creating a backup or mirroring system. In a way where I won't have to touch anything much or most of the time.


----------



## gkontos (Jan 3, 2012)

@hockey97,

Out of personal experience. One server is good only for starting! Also, consider maxing the RAM especially if you want to use ZFS. Don't rely on a UPS for hosting business. You need to find a datacenter where they will guarantee you the proper power supply in a controlled climate. Internet redundancy is something that you can also find in datacenters.

Remember that your clients expect to be able to browse their sites on 24X7 basis. Also, be prepared to use a network firewall and a web application firewall. You can use net-mgmt/nagios and sysutils/munin-node as a tool to monitor your server(s)

External disks are good for backups but eventually you will see that NAS with PXE Boot will be very handy.

George


----------

