LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Simple Backup (https://www.linuxquestions.org/questions/linux-newbie-8/simple-backup-4175504667/)

devinmcelheran 05-11-2014 08:30 PM

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?

frankbell 05-11-2014 08:51 PM

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.

monicablake 05-14-2014 04:52 AM

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).

lleb 05-14-2014 07:35 AM

Quote:

Originally Posted by monicablake (Post 5170566)
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.

frankbell 05-14-2014 08:59 PM

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.

devinmcelheran 05-15-2014 01:42 PM

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.

lleb 05-15-2014 02:57 PM

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.

suicidaleggroll 05-15-2014 03:37 PM

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.


All times are GMT -5. The time now is 10:32 AM.