Page 1 of 1

Backing up

Posted: 6. Apr 2014, 13:18
by Sasquatch
I seem to have a habit of crashing my box. Typically after an update changes something critical and I don't know how to adjust things to make it work again. The problem is that I don't really know how to properly back things up. At the moment, I use the file manager to copy and paste things from various folders onto an 8GB thumb drive. I also have to export bookmarks and e-mail contacts to save them. This is so laborious that I rarely do it. So my backup is months old and out of date.

Isn't there a simpler way to back things up? I don't need the entire system copied onto a disc. But I would like to be able to easily store important stuff like bookmarks and contact information. With only 8GB of space I'm obviously limited to what I can backup. Also, is it possible to backup things like application preferences, wallpapers, themes, etc.?

Re: Backing up - RSYNC, CRONTAB

Posted: 6. Apr 2014, 16:35
by TracyTiger
There are many backup strategies and programs. Fortunately this is not a new problem in the computer world and others have come up with solutions.

Regarding amount of data - You may want to consider one or more external disk drives that you can connect to your computer via USB. Obtain one large enough to back up your entire /home/<user> directory. Another option is to backup your entire system on the external drive.

Regarding efficiency - You might look into the rsync command and crontab. "man rsync" "man crontab".

I just use rsync but there are many backup programs out there that other forum members can probably recommend. I'm new to Salix, it may have a nice backup program easily available.

If you don't know why your system is "crashing" frequently then you may want to spend some time eliminating or reducing that issue. Although "crashing" covers a wide range of causes and symptoms, you may find that you can still still do a clean shutdown of the file system to help avoid loss of data. I like a system that will perform a clean shutdown just by momentarily pressing the power button then waiting.

EDIT: Rather than using the file manager you may want to use the copy command, "cp -a". You could write a small shell script to copy the files/directories desired.

To save space you can also compress the files that are copied. Look up tar with it's compression option (z,Z). There are many ways to move and compress data.

Re: Backing up

Posted: 6. Apr 2014, 17:00
by Sasquatch
I'd never thought about compressing files before backing them up. Thanks for that tip.

The crashes I have don't necessarily have the same cause. That's why I wound up on Salix. My previous distro crashed and the new liveCD wouldn't work. So I installed Salix instead. The couple issues I've had here so far have been my own fault.

Re: Backing up

Posted: 6. Apr 2014, 20:33
by gapan
If you'd rather update your backup every time without having to backup everything that you have backed up before and hasn't changed since, rsync is the right way to go, as TracyTiger noted too. You could use a GUI, like grsync, which makes it a lot easier. You can backup your entire home directory, so that will save settings together with everything else. If space is limited you could certainly exclude directories that you don't care about backing up and take up space. Running

Code: Select all

du -h --max-depth=1 ~/ | sort -h
will show you how much each subdirectory in your homedir uses. You could also use something like baobab (in the mate-utils package) for that too I guess.

WARNING: make sure you get the SOURCE and DESTINATION parts in grsync right. The first one is the SOURCE (where the files that you want to backup are), the second is the DESTINATION (where you want to back them up to). Swap them and you will replace your files with an empty or a previous backup!

If you use rsync, you can't really compress your files so they take up less space. If you want to compress them and use tarballs, you'll have to backup everything each time. In that case, look into compressing with xz, instead of gzip or bzip2, it achieves a lot better compression ratios.

Re: Backing up

Posted: 7. Apr 2014, 00:18
by Sasquatch
Gapan, I just ran the code you posted. Currently my /home directory is only 113M. But all my data is still on the thumb drive. So that will climb. If I cp /home to my thumb drive will that save my e-mail contacts, bookmarks, and other things? I know I need to backup /usr/share to get the themes I've downloaded. /usr/share currently accounts for about 1G.

Obviously, I don't need to back up the entire distro. And I'm quite certain I will never need to back up the entire 200+ GB of space available to /home. I'm also not above using multiple backup media. I really like the convenience of thumb drives. I could maybe get a bigger one to store archived data, my photos and such, and use the smaller one to store other things.

I guess the big detail is that I am lazy. I'm not scared of the terminal. So it doesn't bother me to enter a few lines of code in order to back things up. I just don't want to spend a bunch of time in the process. So far, it sounds like all I have to do is pass the right options to rsync and I'm done. That's pretty easy.

Re: Backing up

Posted: 10. Apr 2014, 15:17
by gapan
Sasquatch wrote:If I cp /home to my thumb drive will that save my e-mail contacts, bookmarks, and other things?
Sasquatch wrote:I know I need to backup /usr/share to get the themes I've downloaded. /usr/share currently accounts for about 1G.
If you have installed the themes systemwide, then yes. And then not only the entire /usr/share, which would be completely wrong. Only the location where the themes are. If you have installed them in your homedir, no, apparently.