public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] backing up system files
@ 2012-12-02 20:29 Philip Webb
  2012-12-03  8:39 ` Michael Hampicke
  2012-12-03 19:17 ` felix
  0 siblings, 2 replies; 3+ messages in thread
From: Philip Webb @ 2012-12-02 20:29 UTC (permalink / raw
  To: Gentoo User

My recently-built machine has an SSD for everyday storage
+ an HDD for less often used stuff + back-ups (in dir  /y ).
To avoid having to re-install the system if the SSD collapses one day,
I wanted to make a simple back-up copy of vital files on the HDD.
There are lots of apps in 'app-backup' & I looked at  3
-- Backintime, Luckybackup, Kbackup -- , which did the job,
tho' configuring them took a bit of concentration.
I also wrote a simple Bash script, which also does the job very well
& which has caused me to remove the GUI apps & use it instead;
it uses  2  exclude files & the code is below (from  /usr/local/bin/ ).

  root:510 bin> cat bsys
  #!/bin/bash
  mount /dev/sdb8 /y
  rsync -av /bin /y/bkp-sys
  rsync -av /etc /y/bkp-sys
  rsync -av /lib32 /y/bkp-sys
  rsync -av /lib64 /y/bkp-sys
  rsync -av /opt /y/bkp-sys
  rsync -av /root /y/bkp-sys
  rsync -av /sbin /y/bkp-sys
  rsync -av /usr --exclude-from '/usr/local/bin/bsys-usrx' /y/bkp-sys
  rsync -av /var --exclude-from '/usr/local/bin/bsys-varx' /y/bkp-sys
  umount /y
  echo "done"
  
  root:508 bin> cat bsys-usrx
  # bsys-usrx : 121116 -- files to exclude from /usr
  local/
  portage/
  src/
  
  root:509 bin> cat bsys-varx 
  # bsys-varx : 121116 -- files to exclude from /var
  empty/
  log/emerge-logs/
  tmp/

HTH others.

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] backing up system files
  2012-12-02 20:29 [gentoo-user] backing up system files Philip Webb
@ 2012-12-03  8:39 ` Michael Hampicke
  2012-12-03 19:17 ` felix
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Hampicke @ 2012-12-03  8:39 UTC (permalink / raw
  To: gentoo-user

Am 02.12.2012 21:29, schrieb Philip Webb:
> My recently-built machine has an SSD for everyday storage
> + an HDD for less often used stuff + back-ups (in dir  /y ).
> To avoid having to re-install the system if the SSD collapses one day,
> I wanted to make a simple back-up copy of vital files on the HDD.
> There are lots of apps in 'app-backup' & I looked at  3
> -- Backintime, Luckybackup, Kbackup -- , which did the job,
> tho' configuring them took a bit of concentration.
> I also wrote a simple Bash script, which also does the job very well
> & which has caused me to remove the GUI apps & use it instead;
> it uses  2  exclude files & the code is below (from  /usr/local/bin/ ).
> 
>   root:510 bin> cat bsys
>   #!/bin/bash
>   mount /dev/sdb8 /y
>   rsync -av /bin /y/bkp-sys
>   rsync -av /etc /y/bkp-sys
>   rsync -av /lib32 /y/bkp-sys
>   rsync -av /lib64 /y/bkp-sys
>   rsync -av /opt /y/bkp-sys
>   rsync -av /root /y/bkp-sys
>   rsync -av /sbin /y/bkp-sys
>   rsync -av /usr --exclude-from '/usr/local/bin/bsys-usrx' /y/bkp-sys
>   rsync -av /var --exclude-from '/usr/local/bin/bsys-varx' /y/bkp-sys
>   umount /y
>   echo "done"
>   
>   root:508 bin> cat bsys-usrx
>   # bsys-usrx : 121116 -- files to exclude from /usr
>   local/
>   portage/
>   src/
>   
>   root:509 bin> cat bsys-varx 
>   # bsys-varx : 121116 -- files to exclude from /var
>   empty/
>   log/emerge-logs/
>   tmp/
> 
> HTH others.
> 

How about:

work ~ # cat backup.sh
#!/bin/bash

mount /dev/sdb8 /y
rsync -av /bin /etc /lib32 /lib64 /opt /root /sbin /usr /var /y/bkp-sys/ \
	--exclude-from 'exclude'

umount /y
echo "done"


work ~ # cat exclude
/usr/local/
/usr/portage/
/usr/src/
/var/empty/
/var/log/emerge-logs/
/var/tmp/

You can rsync multiple directories, just put dem down there one after
another, the last on is the target.

You should also consider setting the --delete flag (deletes file in
backup when deleted on your root filesystem and --delete-excluded which
will delete the files you have excluded in your backup.

I also exclude /var/cache and /var/run


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] backing up system files
  2012-12-02 20:29 [gentoo-user] backing up system files Philip Webb
  2012-12-03  8:39 ` Michael Hampicke
@ 2012-12-03 19:17 ` felix
  1 sibling, 0 replies; 3+ messages in thread
From: felix @ 2012-12-03 19:17 UTC (permalink / raw
  To: Gentoo User

On Sun, Dec 02, 2012 at 03:29:58PM -0500, Philip Webb wrote:
> My recently-built machine has an SSD for everyday storage
> + an HDD for less often used stuff + back-ups (in dir  /y ).
> To avoid having to re-install the system if the SSD collapses one day,
> I wanted to make a simple back-up copy of vital files on the HDD.

I recently installed an SSD to replace three SCSI drives and changed
my backup at the same time to work llike this.  But I just do
everything except /home, /encfs, the mail spool dir, etc.  I also use
a spare IDE drive for a system backup which I manually rsync before a
big emerge, so I can boot the backup if the main system no longer
boots due to emerge screwup.  I have some other changes to make before
testing this.

What I haven't figured out yet is how to reverse rsync the backup to
the main system.  Rsync has no --source-is-always-right option that I
could find.  "cp -a" might work, with a little care for /dev etc, but
it won't delete destination files which aren't in the backup, and the
idea of reformatting the system partition as part of this seems a bit
extreme when rsync is the natural choice for restoring the backup.

-- 
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
     Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
  GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-03 19:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-02 20:29 [gentoo-user] backing up system files Philip Webb
2012-12-03  8:39 ` Michael Hampicke
2012-12-03 19:17 ` felix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox