Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Best ways to backup your Gentoo systems
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
crshbndct
n00b
n00b


Joined: 18 Oct 2012
Posts: 6

PostPosted: Mon Oct 22, 2012 11:23 pm    Post subject: Reply with quote

I used luckybackup (because I am terrible at rsync) to backup /etc/ and /home once a day.

I take a full system image with redobackup once a month or so
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Tue Oct 23, 2012 12:41 am    Post subject: Reply with quote

My KISS backup script, to rsync to my sdb1 partition:
Code:
#!/bin/bash

if ! grep -q "/mnt/sdb" /etc/mtab ; then
    mount /dev/sdb1 -o commit=20 /mnt/sdb || exit 1
fi

# Limit memory usage to 1gb
ulimit -m 1024000

date
for d in bin boot etc lib opt root sbin srv usr var home ; do
    echo "Backing up $d"
    ionice -c3 nice -n 18 rsync -axHq --delete /$d /mnt/sdb/
done &&

umount /mnt/sdb && hdparm -Y /dev/sdb
date
Back to top
View user's profile Send private message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 587
Location: Texas

PostPosted: Thu Oct 25, 2012 4:33 am    Post subject: Reply with quote

I have been using the stage4 method. I have "cloned" a few boxes with it successfully, so I has been my go to since I know it works for me. However, I saw a few interesting thoughts to think about in the ideas above.
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
dtoo
Tux's lil' helper
Tux's lil' helper


Joined: 29 Mar 2004
Posts: 86

PostPosted: Wed Nov 07, 2012 2:04 am    Post subject: Reply with quote

ppurka wrote:
There is also the gentoo stage4method. Not sure if anyone uses it nowadays.

+1 :wink:
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Wed Nov 07, 2012 5:48 am    Post subject: Reply with quote

ppurka wrote:
There is also the gentoo stage4method. Not sure if anyone uses it nowadays.


I've been using stage4 script for quite a while. Works fine.
__
sol
Back to top
View user's profile Send private message
wolfieh
n00b
n00b


Joined: 17 Nov 2009
Posts: 54

PostPosted: Tue Nov 20, 2012 8:41 pm    Post subject: Reply with quote

I use rdiff-backup to save /etc, /home and some other config files
Back to top
View user's profile Send private message
Suicidal
l33t
l33t


Joined: 30 Jul 2003
Posts: 959
Location: /dev/null

PostPosted: Tue Nov 20, 2012 10:07 pm    Post subject: Reply with quote

I just bypass all of the pseudo filesystems by bind mounting and dump to my san.

backup.sh:
#!/bin/bash

        BACKUP_DIR=/mnt/nas
        MOUNT_DIR=/mnt/backup

        if [ ! -d ${MOUNT_DIR} ]; then
                mkdir ${MOUNT_DIR}
        fi

        mount -o bind / ${MOUNT_DIR}

        mount /boot
        mount -o bind /boot ${MOUNT_DIR}/boot

        cd ${MOUNT_DIR}

        tar -cjp ./ -f ${BACKUP_DIR}/backup-${HOSTNAME}-$(date +%Y%m%d).tar.xz

        cd ${HOME}

        umount /${MOUNT_DIR}/boot
        umount /${MOUNT_DIR}
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Tue Nov 20, 2012 11:01 pm    Post subject: Reply with quote

ppurka wrote:
There is also the gentoo stage4method. Not sure if anyone uses it nowadays.


I've used this method some days ago. Not for backing up, for cloning a system. Works fine. Less then two hours for installing a system with all the needed soft.
Back to top
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Tue Nov 20, 2012 11:07 pm    Post subject: Reply with quote

Suicidal wrote:
I just bypass all of the pseudo filesystems by bind mounting and dump to my san.

What does this buy you instead of just dumping those specific directories directly?

EDIT: I should add, 'by passing the "-l"/"--one-file-system" option to tar'
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
Suicidal
l33t
l33t


Joined: 30 Jul 2003
Posts: 959
Location: /dev/null

PostPosted: Wed Nov 21, 2012 12:27 am    Post subject: Reply with quote

Hypnos wrote:
Suicidal wrote:
I just bypass all of the pseudo filesystems by bind mounting and dump to my san.

What does this buy you instead of just dumping those specific directories directly?

EDIT: I should add, 'by passing the "-l"/"--one-file-system" option to tar'


I'll have to check that out.
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Wed Nov 21, 2012 6:04 am    Post subject: Reply with quote

for me, servers get the rsync treatment
desktops/laptops get tar'd, xz'd, and aespipe'd
not a stage4 or anything of the sort, i just have files named '.exclude_me' peppered in various directories, and backup everything else.

ive had that damn rsnapshot wiki bookmarked for ages, have yet to set it up.
i need to figure out a cleaner way to incorporate crypto

what ive been doing is using an encrypted loopback device, keeping no more than a month worth of data.

i simply havent sat down and thought the problem through adequately. largely, because i havent had the spare time recently to sit down and actually, well, think - dear god please let the headcount budget fairy pay me a visit...
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
Q-collective
Advocate
Advocate


Joined: 22 Mar 2004
Posts: 2070

PostPosted: Sun Nov 25, 2012 12:29 am    Post subject: Reply with quote

I use a paid solution via CrashPlan. You can actually use the client for free if you just want to backup to a local external HDD.

I backup to both an USB HDD and to the CrashPlan servers, if anything was to happen with both my computer and my USB HDD.

Edit:
I still find it somewhat amazing how 5 years after Time Machine was released on OS X, why the Linux community (and especially people like Canonical) haven't at least cloned it, let alone improve upon it.
Back to top
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Sun Nov 25, 2012 2:16 am    Post subject: Reply with quote

TimeMachine is a nice GUI wrapper around some basic Unix-y technologies. Back In Time, which is in Portage, may fit the bill.
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
gazj
n00b
n00b


Joined: 18 Nov 2007
Posts: 49
Location: Cambs, UK

PostPosted: Sun Nov 25, 2012 10:46 am    Post subject: Reply with quote

I use rsync to sync data to a machine elsewhere.

I use tar in a cronjob to make backups to a 2tb usb hard drive. I have a backup for everyday of the week and 4xThursday. i.e a months worth.

In my backup I have.

/etc
/home
/usr/local/bin
_________________
Gary
Back to top
View user's profile Send private message
Meet Joe Black
n00b
n00b


Joined: 19 Mar 2005
Posts: 40

PostPosted: Wed Feb 13, 2013 9:59 am    Post subject: Reply with quote

Goverp wrote:
If you use ext2/3/4, you might like to try app-arch/dump. It's a command-line tool, also suitable for scripting. Seems fine to me, and when I tried a partial restore some time back, it worked well. I backup to a USB 1TB drive.

... I run dump after "rc single", which isn't quite as good as rebooting to a different OS and mounting all your target disks R/O, but I expect is good enough.

Hey, can you give us your usual command list or script you usually use to backup your system?

I used rsync to backup my system, but it has the problem that the partition you copying data should be bigger then your system partition. If your system partition and backup partition both have the same size then rsync will fail with corrupted not fully backuped system. Can app-arch/dump backup my system partition to another partition of the same size?
_________________
Some strange sentences ? Grammar mistakes ?
I'll be happy if you write a short PM, I always try to improve my English.
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1972

PostPosted: Wed Feb 13, 2013 12:12 pm    Post subject: Reply with quote

Your wish is my command!

Here's the "backup" shell script. Backup is a bad choice of name, as lots of things use it; perhaps dumpbackup would be better.
Code:
#!/bin/bash

### Use ext2/3/4 dump utility to backup to an external drive ###

# Locate our configuration file
conf=`dirname $0`/backup.conf
conf=`realpath $conf`
echo "Using $conf"
source $conf

set -ue

### Use the ext2/3/4 dump command for a given file system to a given directory ###
dodump() {
  local dir=$1
  local fs
  if [[ $dir == $rootfs ]] ; then
    fs=""
  else
    fs=$dir
  fi

  echo
  echo "Dumping $dir"

  local file=$path/$dir/$name

  dump -${level}uy -L $name -f $file.dump /$fs
}

#### Test parameters or die ###
die() {
echo $*
exit 1
}

# Processing starts here                                                                                                                           
# Check the command line                                                                                                                           
if [[ $# -eq 0 ]] ; then die "Syntax: backup <level> { <filesystem>... }" ; fi                                                                     
                                                                                                                                                   
level=$1                                                                                                                                           
                                                                                                                                                   
if [[ ! `rc-status --runlevel` == "single" ]] ; then die "You must be in run mode single."
elif [[ ! $level == [0123456789] ]] ; then die "You must specify a numeric dump level."
elif [[ ! ( -d $path && -w $path ) ]] ; then
{
  mount $mountpoint
  if [[ ! ( -d $path && -w $path ) ]] ; then die "You must mount the dump drive at $mountpoint" ; fi
}
fi

# Get the mount points to dump
shift
if [[ $# -eq 0 ]] ; then
  filesystems=$defaultfs
else
  filesystems=$*
fi

# Generate dump file names
date=`date +%y%m%d`
if [ $level -eq 0 ] ; then
  name="Full-$date" ;
else
  name="Incr-$date-$level" ;
fi

echo "Dump label $name"
echo "Dumping filesystems $filesystems"

# For good measure, flush data to disk
sync

# Finally, dump
for fs in $filesystems ; do
  dodump $fs
done

# Inform the customer how much space is used on the backup volume
df -h $mountpoint
ls -lh $path/*/$name.dump

exit


You configure it using "backup.conf" like the following:
Code:
# Backup config

# mount point directory to mount the backup drive
mountpoint=/mnt/dumps

# path to backup directory within the backup drive
path=${mountpoint}/acer

# name used for root file system (i.e. "/")
rootfs=slash

# Default list of file systems to dump.  Put the smallest first
defaultfs="boot home var ${rootfs}"


The backup script writes to whatever device is mounted at the specified point - in my case a 1TB external USB drive formatted for ext2, in the specified directory, one subdirectory for each file system you dump (named by the file system mount point).

The dump is compressed using LZO, and seems to get about a 15% reduction overall, more like 50% on /var, but not a lot on my /home as it contains 100 Gb of photos and music, which don't compress any more.

Level 0 backups get called Full-{yymmdd}.dump, others Incr-{yymmdd}-{level}.dump.

If you have an fstab entry for the backup device, the script will mount it; otherwise you need to mount it yourself first.

Apologies for any bad BASH grammar; I'm a relative newbie at BASH.
_________________
Greybeard
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2588
Location: Near Toronto

PostPosted: Wed Feb 13, 2013 1:07 pm    Post subject: Reply with quote

another rsync hard links cumulative based backup is

Quote:
app-backup/snapback2


very simple and works perfectly
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
Meet Joe Black
n00b
n00b


Joined: 19 Mar 2005
Posts: 40

PostPosted: Wed Feb 13, 2013 2:59 pm    Post subject: Reply with quote

Well, thanks Goverp. I've just read your script. But I need to know how to make rc-status runlevel == single and how to make it normal status again.
And I want to backup the whole system partition to not file but another partition of the same size on different drive. Is it possible with dump? I usually use general HDD disks and backup system partition to another disk. In case my primary partiton becomes bad I just change SATA cables and reboot with backuped partition.
_________________
Some strange sentences ? Grammar mistakes ?
I'll be happy if you write a short PM, I always try to improve my English.
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1972

PostPosted: Thu Feb 14, 2013 9:59 am    Post subject: Reply with quote

Meet Joe Black wrote:
Well, thanks Goverp. I've just read your script. But I need to know how to make rc-status runlevel == single and how to make it normal status again.

Type "rc single" as root, or pass the "single" parameter as part of your kernel boot parameters (from grub or lilo or whatever). To revert, type "rc default". But read on before you try it. I don't think "dump" does what you want.
Meet Joe Black wrote:

And I want to backup the whole system partition to not file but another partition of the same size on different drive. Is it possible with dump?

No, dump doesn't do that; it creates a backup file containing compressed copies of the data together with its own indexing system that mimics the file system's directory structure. It allows you to recover individual files, directories or the whole file system. But what you appear to want is a simple copy of the file system. The usual command to do that is "dd" from one block device to another. I don't use dd much, so I can't offer more advice.

Question: do you actually want a backup - that is, a system that lets you recover old versions of a file, or old files, in case they become corrupted or deleted in error, or a system that protects you against hardware failures? If you are worried about hardware failures, and want a copy of your current partition so you can restart with that if the original is damaged, consider using software RAID. That constantly keeps the two partitions synchronized and lets you continue working if one drive has a hardware problem, though of course you have to have both drives available all the time, and can't just plug an external USB drive to "take a backup". That seems to be what you are describing below.
Meet Joe Black wrote:
I usually use general HDD disks and backup system partition to another disk. In case my primary partiton becomes bad I just change SATA cables and reboot with backuped partition.

_________________
Greybeard
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum