LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-11-2014, 09:30 PM   #1
devinmcelheran
Member
 
Registered: Jan 2009
Location: Ontario, Canada
Distribution: Arch Linux
Posts: 145

Rep: Reputation: 16
Simple Backup


So, I'm looking to do a simple one time backup, or at least occasional backup of my home server. It's nothing dynamic, so I just need to backup the configurations really, but I'd still like to have a snapshot of the whole filesystem just in case. The issue now is that I don't know how to do that without backing up the drives connected under "/NAS". I want to backup my system snapshot to "/NAS/data" but not including "/NAS/data" or any other child directories of "/NAS".

How would I go about doing that in the simplest way?
 
Old 05-11-2014, 09:51 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,342
Blog Entries: 12

Rep: Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730
There's little to be gained from backing up the whole file system. If this machine crashes and must be recreated, reinstalling the OS is simpler than trying to restore from backup. What you need are the configuration and data files.

I would recommend backing up the contents of /etc (where system-wide configuration files are located) and of your /home/[username] directory, including the hidden files and directories (the ones preceded by a dot, as in ~/.libreoffice; this latter will capture all your data files. Those hidden files and folders contain your personal configuration settings.

In addition, if you have personal files elsewhere (for example, I have a working clone of my website in /opt/lampp/htdocs), you should of course grab them also . . . .

Strictly speaking, regarding the configuration settings, you really need only to back up the ones you have modified. For example, I always back up my /etc/samba/smb.conf (samba settings) file, because I have tweaked it over the years so it works for me, and I'd hate to have to recreate it. The same goes for my ~/.fluxbox directory, where my Fluxbox configuration resides. I don't back up configuration files that I have left at default values.

Last edited by frankbell; 05-11-2014 at 09:52 PM.
 
Old 05-14-2014, 05:52 AM   #3
monicablake
LQ Newbie
 
Registered: Feb 2014
Posts: 2

Rep: Reputation: 0
I am using Acronis for this. They can do System Image backup on Disk level. If you are on dual boot you could even do this out of Windows – but they have Linux version too.

Should be pretty much what you are looking for.

I would also suggest to stay away from “No need to backup all, backup/etc only” advices.

The argument on what to backup (/var? /tmp? funny apps which put data to /opt and /usr?) could go forever. Disks are big and cheap – just backup everything and be done with it.

Basic setup will definitely take less than 30 minutes in both directions (backup and restore).
 
Old 05-14-2014, 08:35 AM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
Quote:
Originally Posted by monicablake View Post
The argument on what to backup (/var? /tmp? funny apps which put data to /opt and /usr?) could go forever. Disks are big and cheap just backup everything and be done with it.

Basic setup will definitely take less than 30 minutes in both directions (backup and restore).
have you ever tried backing up 8TB of data onto a single disk backup? most consumer grade NAS devices are not even that large.

Stick with backing up the basics. /home /etc /var maybe /usr/bin if you have customer scripts in there, but then better off just grabbing the specific scripts you want/need via your exclude.txt file and the make a copy of the specific scripts into your /home/user directory.

yes storage is cheap, at times, and disks are larger then they have been in the past. still there is little reason to backup / or many of the other directories out there.

in fact i might even argue that grabbing all of /etc and /var are not required either.

if you have a hardware failure and need to be up and running as long as it was not the HDDs that died, taking them and putting them into a new computer will not hurt anything. Linux =! MS in this regard and the OS will just keep on working. The kernel will/might need some new modules loaded and maybe some 3rd party drivers depending on the hardware change, but thats nothing compared with the BSOD from a MS hardware change.

if you are worried about the HDDs going down, then really all you need is your data and custom scripts. you will be performing a full fresh install of the latest greatest of your distro of choice anyways if you lose your HDDs. that is unless under contract for support for say RHEL, Ubuntu LTS, SuSe, etc... and even then you will be better off with a fresh install onto fresh hardware to reduce bloat in the kernel.

a simple rsync script with -aviS and maybe adding in a z flag if you want compression over the network with an excludes.txt and some part of the script that copies any custom scripts you have floating around the system to your /home along with your network settings, hosts, allow/deny. or other such files you might have edited like IPTables. this is all doable in roughly 150-200 lines of code of much less all depending on how customized your system is.
 
Old 05-14-2014, 09:59 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,342
Blog Entries: 12

Rep: Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730
rsync, which should be included with your distro, is a command line tool favored for many for backups to drives (as opposed to optical media). Unfortunately, the man page and many of the online references for how to use it are pretty impenetrable.

There's a GUI front end for rsync called BackinTime; I haven't used it, but Dmitri gave it a good review on Sourcetrunk several years ago.
 
Old 05-15-2014, 02:42 PM   #6
devinmcelheran
Member
 
Registered: Jan 2009
Location: Ontario, Canada
Distribution: Arch Linux
Posts: 145

Original Poster
Rep: Reputation: 16
I'm not running an X server on the machine, it's all CLI. I think I'll be fine with just the configuration files, so I'd grab /etc and /var, that should cover everything I need, maybe /opt has some stuff in it, I haven't actually checked. But I'm worried the disk might die on me eventually and it's actually only an IDE disk, so it's super slow. That being said, I run a lot off of it. I have a website, VPN, media/file services, and Plex (if anyone doesn't know what it is, it's amazing, look it up) and a couple other things. I'd like to be able to extract the files and have them all go back to where they came from, regardless of my working directory and so on. I can't remember how to do that, but we went over it in class. I just need the easiest way to accomplish it. Nothing fancy, it doesn't have to be automated and scheduled. Everything is working as is, so a configuration snapshot would get me back there if necessary.

Thanks for all the input.
 
Old 05-15-2014, 03:57 PM   #7
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
thats what the -a is for. its for archiving.

for keeping the paths you would include the trailing / only for the destination.

ex:

Code:
# rsync -aviS /path/to/source user@IP:/path/to/destination/
this will create the directory in the destination path if it is not there, but not created a duplicate. ie: if the destination path is /etc then it will not create /etc/etc and screw things up.

if compression is required then add the -z flag IIRC.
 
Old 05-15-2014, 04:37 PM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Just use rsync -a, and exclude any directories you're not interested in.

Code:
rsync -a /* /NAS/data --exclude={/NAS/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/var/lib/ntp/proc/*}
Of course modifying the exclude list as necessary for your system and your backup needs.
 
  


Reply

Tags
backup


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
The linux software "simple backup" - how backup everything? Bob Appleby Linux - Software 1 09-20-2010 12:59 AM
Newbie trying to write a simple backup script to backup a single folder Nd for school stryker759a Linux - Newbie 2 09-16-2009 09:52 AM
Need Help For SImple Backup Jonzkie Linux - Newbie 5 01-12-2009 07:51 PM
simple-backup-script ahmed4linux Linux - General 1 05-04-2005 08:10 PM
simple MySQL backup Thulemanden Linux - Software 1 02-09-2004 04:03 PM


All times are GMT -5. The time now is 01:13 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration