Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

Best ways to backup your Gentoo systems

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
44 posts
  • Previous
  • 1
  • 2
Author
Message
crshbndct
n00b
n00b
Posts: 6
Joined: Thu Oct 18, 2012 3:17 pm

  • Quote

Post by crshbndct » Mon Oct 22, 2012 11:23 pm

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
Top
PaulBredbury
Watchman
Watchman
User avatar
Posts: 7310
Joined: Thu Jul 14, 2005 3:47 pm

  • Quote

Post by PaulBredbury » Tue Oct 23, 2012 12:41 am

My KISS backup script, to rsync to my sdb1 partition:

Code: Select all

#!/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
Top
njcwotx
Guru
Guru
User avatar
Posts: 587
Joined: Fri Feb 25, 2005 3:53 am
Location: Texas

  • Quote

Post by njcwotx » Thu Oct 25, 2012 4:33 am

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.
Top
dtoo
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 86
Joined: Mon Mar 29, 2004 2:05 am

  • Quote

Post by dtoo » Wed Nov 07, 2012 2:04 am

ppurka wrote:There is also the gentoo stage4method. Not sure if anyone uses it nowadays.
+1 :wink:
Top
solamour
l33t
l33t
User avatar
Posts: 749
Joined: Tue Dec 21, 2004 11:29 pm
Location: San Diego, CA

  • Quote

Post by solamour » Wed Nov 07, 2012 5:48 am

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
Top
wolfieh
n00b
n00b
Posts: 54
Joined: Tue Nov 17, 2009 7:11 pm

  • Quote

Post by wolfieh » Tue Nov 20, 2012 8:41 pm

I use rdiff-backup to save /etc, /home and some other config files
Top
Suicidal
l33t
l33t
User avatar
Posts: 959
Joined: Wed Jul 30, 2003 4:55 am
Location: /dev/null

  • Quote

Post by Suicidal » Tue Nov 20, 2012 10:07 pm

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

Code: Select all

#!/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}
Top
creaker
l33t
l33t
Posts: 651
Joined: Sat Jul 14, 2012 11:20 am

  • Quote

Post by creaker » Tue Nov 20, 2012 11:01 pm

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.
Top
Hypnos
Advocate
Advocate
User avatar
Posts: 2889
Joined: Thu Jul 18, 2002 5:12 pm
Location: Omnipresent

  • Quote

Post by Hypnos » Tue Nov 20, 2012 11:07 pm

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
Top
Suicidal
l33t
l33t
User avatar
Posts: 959
Joined: Wed Jul 30, 2003 4:55 am
Location: /dev/null

  • Quote

Post by Suicidal » Wed Nov 21, 2012 12:27 am

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.
Top
cach0rr0
Bodhisattva
Bodhisattva
User avatar
Posts: 4123
Joined: Thu Nov 13, 2008 11:14 pm
Location: Houston, Republic of Texas

  • Quote

Post by cach0rr0 » Wed Nov 21, 2012 6:04 am

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
Top
Q-collective
Advocate
Advocate
User avatar
Posts: 2077
Joined: Mon Mar 22, 2004 5:21 pm

  • Quote

Post by Q-collective » Sun Nov 25, 2012 12:29 am

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.
Top
Hypnos
Advocate
Advocate
User avatar
Posts: 2889
Joined: Thu Jul 18, 2002 5:12 pm
Location: Omnipresent

  • Quote

Post by Hypnos » Sun Nov 25, 2012 2:16 am

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
Top
gazj
n00b
n00b
User avatar
Posts: 49
Joined: Sun Nov 18, 2007 12:43 am
Location: Cambs, UK

  • Quote

Post by gazj » Sun Nov 25, 2012 10:46 am

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
Top
Meet Joe Black
n00b
n00b
Posts: 40
Joined: Sat Mar 19, 2005 8:59 am

  • Quote

Post by Meet Joe Black » Wed Feb 13, 2013 9:59 am

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.
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2404
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Wed Feb 13, 2013 12:12 pm

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: Select all

#!/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: Select all

# 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
Top
albright
Advocate
Advocate
User avatar
Posts: 2588
Joined: Sun Nov 16, 2003 6:36 pm
Location: Near Toronto

  • Quote

Post by albright » Wed Feb 13, 2013 1:07 pm

another rsync hard links cumulative based backup is
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)
Top
Meet Joe Black
n00b
n00b
Posts: 40
Joined: Sat Mar 19, 2005 8:59 am

  • Quote

Post by Meet Joe Black » Wed Feb 13, 2013 2:59 pm

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.
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2404
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Thu Feb 14, 2013 9:59 am

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
Top
Post Reply

44 posts
  • Previous
  • 1
  • 2

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic