LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-11-2012, 07:51 AM   #1
tezarin
Member
 
Registered: Nov 2007
Posts: 133

Rep: Reputation: 0
How to backup a Unix machine?


Hi,
I have two Unix machines and they both are file servers. I have Samba installed on both of them and there are files which are being shared remotely by my Windows users.

I would like to have backups of the structure in case something happens in the future and the boxes get corrupted (I've already gotten the files backed up) so that if the machine burns out, then I can quickly install CentOS on another machine and get the box up and ready to go in less time.

What is the best way to back up the structure of the machine and which files/directories need to be backed up?

Thanks
 
Old 10-11-2012, 08:21 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You say "UNIX" then mention "CentOS". CentOS is Linux. Although there are lots of similarities because Linux started as a clone of Linux it isn't really proper to call it UNIX. Most people when speaking of UNIX and Linux say *nix.

So are both the system's you're talking about CentOS?

If so I'd recommend MondoRescue: http://www.mondorescue.org/

It lets you create an install CD or DVD that looks like the system you created the image from.

As to what to include in it the answer would be anything you're NOT including in other backups. In general the system directories you need are /etc, /var, /usr, /bin and /sbin, /root and any individual files in / itself. What we do here is setup our applications and databases in separate filesystems (e.g. /application, /database) and exclude those from OS backups because we back those up separately (not using Mondo).

Ideally you should create the Mondo image, do a backup of the OS say once a week, do a backup of any application/data that changes at least that often. In a rebuild scenario you'd reload from the Mondo image, restore the most recent OS backup then restore the most recent application/data backups.

Of course if your system is small enough you could actually put it all in a Mondo image. Since Mondo generates iso files you don't even have to burn them to media - you can simply copy them off to other locations and burn them when you need them (or use other install methods).
 
Old 10-11-2012, 08:47 AM   #3
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
If they are simple file servers running SAMBA, and this is a personal/small business setup, you don't have to go hog-wild backing up everything,... Just the directories with data, user accounts and the SAMBA config. If they are running other services, then that's different. Basically, anything you change from a standard install needs to be backed up. You can do that simply with something like rsync (or grsync for graphical interface).

If this is an enterprise setup, that's different. In that case you might want to virtualize the SAMBA servers, clone the virtual machines and store them away as backups, and, obviously, your data. If the machine fails, you get a machine that'll run your virtualization software (VMware, KVM, VirtualBox, whatever), and pull over your cloned backup,... & presto! you're back up again. Some servers require special access to hardware that doesn't lend itself to virtualization ... For those situations, you need a complete backup solution.
 
Old 10-11-2012, 08:59 AM   #4
oneindelijk
Member
 
Registered: Oct 2012
Location: Belgium
Distribution: Xubuntu
Posts: 32

Rep: Reputation: Disabled
If you rather have a full disk backup, give DriveImage a try.
It makes an image from a running system and it's free
 
Old 10-11-2012, 09:11 AM   #5
tezarin
Member
 
Registered: Nov 2007
Posts: 133

Original Poster
Rep: Reputation: 0
Thanks for your replies, very helpful.

Two servers are just simple Samba servers. The third server is the mail server. The OS for all three are CentOS. The mail server software is Zimbra.

Since I'm new to this, let me make sure I understand everything correctly:


1) For the Samba servers, I copy these directories: /user, /etc, /var, /usr, /bin and /sbin, /root and the directory where the actual shared files are.

2) For the mail server, I copy the above directories as well as the /opt/zimbra directory (per zimbra forum folks that's where Zimbra files are)

But how would I copy them? I grabbed a 500 GB external hard drive, installed WinSCP and copy the files remotely from my CentOS machines to my Windows XP machine and paste them into that 500 GB drive? Sorry if that sounds silly, I'm trying to learn, please bear with me.

Thanks
 
Old 10-11-2012, 09:37 AM   #6
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
Uhmm,...

I suggest you study a bit more about Linux file/directory structure in general, and CentOS in particular. The default SAMBA config file is located at /etc/samba/smb.conf ...

In CentOS, SAMBA configuration is complicated by the SELinux stuff and iptables rules. You don't necessarily have to backup everything. You'll want to capture SAMBA configurations, security configurations, logs, maybe user accounts,... etc. In your #1, above, you are basically stating that you'll be backing up above 80% of the entire system,... for what is probably, more or less a standard CentOS install. Wasteful at best,... missing important info at worst... At that point, you might as well just clone the entire system, imaging the entire drive. If you did that, you (or someone helping you) would be able to recover the system...

The directories, /usr, /etc, /var, /bin, /sbin, etc. are going to contain A LOT of data totally unrelated to the SAMBA file server,... just standard system install stuff...

How many users do you have? How much file space is being utilized in the shared files? How many files? What kind of data, and what kind of operation is this? Why are there two SAMBA servers versus one?

Why would you try to throw backups on a WinXP machine (Windows doesn't respect Linux file/directory structure very well, you know)?

Those questions, and their answers, are going to determine what type of backup plan you are going to implement.
 
Old 10-11-2012, 09:49 AM   #7
eyanu
Member
 
Registered: Jul 2012
Location: kampala,Uganda
Distribution: backtrack
Posts: 87

Rep: Reputation: Disabled
One command i like using is rsync, it lets you synchronize files from one server to another, you can create a cron to do that to whatever time you want so your files will be in sync, one machine has to be be a client while the other the server.
 
Old 10-11-2012, 09:51 AM   #8
tezarin
Member
 
Registered: Nov 2007
Posts: 133

Original Poster
Rep: Reputation: 0
I already have backed up the files (Excel, Word, etc) as well as the samba conf file. It would be super easy for me to set up a new machine, install CentOS on it followed by a clean install of Samba. But I would like it to make it fast to get that new box up and running if I need to.
So you're right, I probably don't need to back up all those directories.
I was trying to move them to the external hard drive which I have attached to my Windows machine (remotely) simply because I didn't know what else I can do to backup the data.

You mentioned cloning, how does that work? I need to make sure if something happens to the mail server, I have a clone that I can easily put to use immediately.

Thanks,
h
 
Old 10-11-2012, 09:59 AM   #9
oneindelijk
Member
 
Registered: Oct 2012
Location: Belgium
Distribution: Xubuntu
Posts: 32

Rep: Reputation: Disabled
if you have the space you can clone your partitions with dd
Quote:
dd if=/dev/sda1 of=/media/USBDISK/IMGFILE.img
Where you should replace sda1 with the partition you are backing up, USBDISK with the name of the target filesystem, and IMGFILE with the name you want to give to the backup.
This can take a long time though, depending on the size of the partition
 
Old 10-11-2012, 10:13 AM   #10
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
You want my REAL suggestion?!?!

If this is one physical location....

* Use ONE relatively powerful machine that has hardware virtualization support. Install KVM. Create two virtual machines,...
* One as file server, the other for mail server.

* Use the external drive as your file storage area.
* Have a second external for storing backups (1 TB drives are relatively cheap now,... I suggest Seagate over WD, because WD puts a lot of crap on their drives).
* Format your external drives as EXT4.
* Do not use Windows file formats on the servers or their external drives,... SAMBA will take care of compatibility for you.

Duplicate your existing SAMBA setup on the file server VM, and the Zimbra mail server on the other. (Copy the necessary config files if you can, or just use them for reference when setting up the new ones)

When the VM servers are set up,... clone them (using the KVM management utility).
For the uninitiated, KVM is pretty much like VirtualBox in the way it works, or similar enough, anyways.

For backups, clone them on a regular basis (during off-peak hours). That can be set up as a cron job, eventually, so it's more hands-off.

Then,... Learn Linux,... well,... basic shell scripting,... security,... how a system I initializes,... etc.

Oh,... and I'm sure others will have competing ideas for what you should do... take them all in, and make an informed decision. There's more than one way to skin a cat...
 
Old 10-11-2012, 10:30 AM   #11
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I think the discussion has gotten off track. The OP mentioned backups but his post seemed to indicate his real concern was how to quickly build a NEW server if the current one failed.

While installing a new server from scratch and copying in the application/data files sounds reasonable on its face in reality it ignores the possibility that the applications he's running require special files in other locations such as /etc, /var, /usr/lib, /usr/share or /usr/local even though the application itself is mainly installed in a completely different area. If so he'd be losing times on a fresh build because he'd have to reinstall or at a minimum reconfigure such files for the application to work properly. Additionally there are other setups that aren't part of the application but are required for it (e.g. networking).

This is why I suggested Mondo - it creates an image of the system as it is but moreover creates it as an installable ISO so it can be used to install on new hardware doing the same setup.

It appears the suggestion for DriveImage may be for the same but I'm not familiar.

The suggestions for cp, rsync etc... don't address what the OP asked originally.
 
Old 10-11-2012, 10:52 AM   #12
tezarin
Member
 
Registered: Nov 2007
Posts: 133

Original Poster
Rep: Reputation: 0
Thanks everyone. I appreciate all the info.

I would like to try Mondo, the KVM solution is good, but MensaWater is right, I would like to be able to quickly put a server back in the rotation should things go wrong one day (God forbidden of course).

How do I start with Mondo? What do I need to do?

thanks
 
Old 10-11-2012, 11:02 AM   #13
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
Then go with Mondo,... but research and explore virtualization for the (near) future,...

If you want to be back up fast,... there's nothing like firing up a backup virtual machine clone after the one in use has failed. We're talking minutes (provided you have other running hardware), versus hours...

However, I suspect that your hardware is going under-utilized. Having two SAMBA servers in the same physical location just smacks of overkill. I also suspect that your operation is on the small-ish size (around 10-35 users, or less). For mail and file serving, more than one physical server is often overkill for an organization of that size.
 
Old 10-11-2012, 11:45 AM   #14
tezarin
Member
 
Registered: Nov 2007
Posts: 133

Original Poster
Rep: Reputation: 0
JaseP, dopesn't Mondo do the same thing? It gets an image of the machine which can later on be installed on the new machine?

Is there anywhere I can ready more on your solution (virtualization and KVM)?

Thanks
 
Old 10-11-2012, 11:55 AM   #15
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Virtualization is a good thing and as Jase says can be used to very quickly getup a clone of your virtual host. Unfortunately it is on the same physical hardware so having that hardware fail would kill both the live VM and the clone.

There ARE methods for copying VM clones from one physical server to another but it requires having the virtualization setup on both hosts at the same time. I've seen a lot of discussion on that for VMWare so possibly KVM allows for it as well.

KVM is the virtualization that later versions of RHEL5 and all versions of RHEL6 want you to use. Since CentOS is a binary compile from RHEL source it has much the same functionality so any document you find discussion RHEL KVM setup would be applicable to CentOS.

You haven't mentioned what version of CentOS you're running (type cat /etc/issue to find out). Earlier versions of RHEL5 (and therefore CentOS 5) supported Xen rather than KVM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find unix machine Muthu R Linux - Hardware 3 01-05-2011 10:00 AM
backup unix via network... m.h.shams Linux - Networking 1 06-10-2006 05:42 PM
Dual HD Backup in Sco Unix xbill311x Other *NIX 6 06-22-2005 09:47 PM
Display of Unix Machine on a PCQ Linux Machine gopalkasat Linux - Networking 1 12-14-2004 02:37 AM
Suse 8.2 -> UNIX Type: L8 Backup DrNeil Linux - Networking 2 08-31-2004 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration