SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2015-03-31 03:50:39

KrunchTime
#! Die Hard
From: not where I belong
Registered: 2012-03-02
Posts: 3,264

Apt History and Configuration File Backup

Last edited by KrunchTime (2015-03-31 03:52:07)

Offline

Be excellent to each other!

#2 2015-03-31 03:51:42

KrunchTime
#! Die Hard
From: not where I belong
Registered: 2012-03-02
Posts: 3,264

Re: Apt History and Configuration File Backup

Place holder for change history.

Offline

#3 2015-03-31 03:54:31

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Apt History and Configuration File Backup

This looks like a good candidate for an rsync script. Would be simple enough to sync all of my configs over to my Crunchbang Waldorf box.

Offline

#4 2015-03-31 04:07:00

KrunchTime
#! Die Hard
From: not where I belong
Registered: 2012-03-02
Posts: 3,264

Re: Apt History and Configuration File Backup

Maybe...I never thought of that, although I haven't made the time to learn scripting yet.

Offline

#5 2015-03-31 06:45:21

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Apt History and Configuration File Backup

# rsync -aAXv $SOURCE $DESTINATION

Offline

#6 2015-03-31 14:22:55

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Apt History and Configuration File Backup

 31 Mar 15 | 11:17:51 ~
    $ s11bk
Syncing /home     to /media/disk/S11-Mar/
Syncing /media/5/ to /media/disk/M5/

1. Syncing Complete
2. Unmount /media/disk? (Y|n) 
/media/disk Unmounted - Unplug now.
 
 31 Mar 15 | 11:20:23 ~
    $ 

Last edited by Sector11 (2015-03-31 14:29:36)

Offline

#7 2015-03-31 15:43:42

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Apt History and Configuration File Backup

Yeah I should have noted, I have some bash wrappers setup already to backup media. It would be simple enough to fix them up to backup configs. When I get the time, I will possibly post them here. Do note, they are merely wrapper to help my mind with the complexity of an rsync command.

Offline

#8 2015-03-31 20:58:33

KrunchTime
#! Die Hard
From: not where I belong
Registered: 2012-03-02
Posts: 3,264

Re: Apt History and Configuration File Backup

Offline

#9 2015-03-31 21:01:08

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Apt History and Configuration File Backup

Offline

#10 2015-03-31 21:02:30

KrunchTime
#! Die Hard
From: not where I belong
Registered: 2012-03-02
Posts: 3,264

Re: Apt History and Configuration File Backup

^ Automated backups are good for servers and desktops for those who can't seem to understand the importance of making a backup of a changed file.

Offline

#11 2015-03-31 21:30:29

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Apt History and Configuration File Backup

The nice thing about rsync is that it can do file diffs to see what needs to be backed up. Then, if I want automation, I just schedule it as a cron job. If not, then I have a couple of simple wrapper scripts in ~/bin that are a tad more mnemonic and memory friendly to run manual backups. I backup music automatically, but need finer grained control over my movies, as I keep my kid's movies separated from mine. That way they are not accidentally subjected to zombie apocalypses, etc.

Backing up configs automatically makes a ton of sense to me, especially regarding how hard it is for me to track all the changes I make for each Live Build I do.

Offline

#12 2015-03-31 21:39:36

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Apt History and Configuration File Backup

Offline

#13 2015-03-31 22:10:05

KrunchTime
#! Die Hard
From: not where I belong
Registered: 2012-03-02
Posts: 3,264

Re: Apt History and Configuration File Backup

Thank you for the additional info, damo.

Offline

#14 2015-03-31 23:34:48

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Apt History and Configuration File Backup

Offline

#15 2015-04-01 00:19:16

KrunchTime
#! Die Hard
From: not where I belong
Registered: 2012-03-02
Posts: 3,264

Re: Apt History and Configuration File Backup

^ Another thank you.

Offline

#16 2015-04-01 01:52:59

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Apt History and Configuration File Backup

#!/bin/bash
	#rsync configs over ssh to backup
	rsync -aAxv ~/.config/compton user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv ~/.config/openbox user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv ~/.config/tint2 user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv ~/.conkyrc user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv ~/conky_clock_rc user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv ~/bin user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv /etc/fstab user@192.168.1.2:~/backup/wtfbox/configs
    rsync -aAxv /etc/apt/preferences user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv /etc/apt/sources.list user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv /var/log/apt/history.log user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv /etc/asound.conf user@192.168.1.2:~/backup/wtfbox/configs
	rsync -aAxv /etc/polkit-1 user@192.168.1.2:~/backup/wtfbox/configs
	
exit 0

Offline

#17 2015-04-01 02:12:38

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Apt History and Configuration File Backup

^ Couldn't you use an includes file, which has a list of the filepaths you want to rsync? Then use something like

rsync -av `cat /path/to/file` /destination/

There is also  "--recursive --files-from="

Offline

#18 2015-04-01 02:46:23

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Apt History and Configuration File Backup

Yeah I was thinking something like that. The above example is a bit unwieldy and I would like it to be simple enough to configure that it would keep stuff I have found to be a pain to set up backed up for me.

Offline

#19 2015-04-01 03:57:08

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Apt History and Configuration File Backup

Offline

#20 2015-04-02 00:54:10

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Apt History and Configuration File Backup

Ok. Worked on this some and got it working. Thanks for the tip @damo. I didn't quite get it to work that way but this did work, plus copied the directory hierarchy over nicely as well:

#!/bin/bash
	rsync -arAX --files-from=$HOME/.config/backup-conf / user@192.168.1.2:~/backup/wtfbox/configs
exit 0

then the file list at $HOME/.config/backup-conf

/home/tknomanzr/.config/compton/
/home/tknomanzr/.config/openbox/
/home/tknomanzr/.config/tint2/
/home/tknomanzr/.conkyrc
/home/tknomanzr/conky_clock_rc
/home/tknomanzr/bin/
/etc/fstab/
/etc/apt/apt.conf.d/
/etc/apt/sources.list
/var/log/apt/history.log
/etc/asound.conf
/etc/polkit-1/
/etc/systemd/

I can create any arbitrary list I want now. Also, if you want the file list to sit on the host as well, simply put a : in front of the --files-from=/path, like so:

--files-from=:/$HOME/path/to/file

This is setup to push files to the host.

Offline

#21 2015-04-02 03:20:44

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Apt History and Configuration File Backup

I just back up in big chunks:
everything in /etc
everything in /home
most of /data
That just about covers it, except for
/var/log/apt/history.log

/etc isn't really all that big, and if there are some huge files or directories in /home or /data (if you use a /data that is) that you don't want to back up, you can make an "excludes" file to keep them out. I find this exclusive approach a bit easier on the nerves - there's less chance of forgetting to back up something important.

So, fwiw, my rsync line:

sudo rsync -av --exclude-from=$HOME/.config/user/backup_excludes /etc /boot/grub /data /home /media/backup/Desktop-backup

/media/backup is the mounted hard disk.

And, again fwiw, a typical "excludes" file:

/data/.Trash*
/data/bigstuff
/data/john/downloads/transmission
/data/john/downloads/k3b
/data/john/Virtualbox_vms
/home/*/.mozilla/**/Cache
/home/*/.local/share/Trash
/home/*/.thumbnails
/home/*/.cache
/home/*/.gvfs
/home/john/.dropbox-dist*
/home/john/.dropbox/cache/*
/home/john/.wine

Storage space is so cheap these days it's easiest to just throw it all in. As damo said, once you've run it the first time, the following backups will be pretty fast.

Offline

#22 2015-05-19 12:38:04

userx-bw
#! Die Hard
From: stuck in an unknown reality
Registered: 2013-11-19
Posts: 735

Re: Apt History and Configuration File Backup

Last edited by userx-bw (2015-05-19 12:43:14)


"How can you learn how to fix it, if you don't break it first? ops
"the only way to get away with murder is - by killing time" swp 1997  monkey
"A computer is only as smart as the person using it"
"Just plug it in and see if it blows up, if not then take it apart and figure out how it works."

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo