Contents
|
DockStar Backup
In order to have a convenient data backup I wanted to have something similar to Time Machine from Apple Mac OS X.
The program Back in time did a good job in the past on my Ubuntu 12.04 server, so I wanted to use it also on the Dockstar server in console mode with Debian 7 (wheezy). Unfortunately this is not very much documented. Therefore I try to document this console mode.
There is no parameter editor for the console. The config file was setup with the GUI under Ubuntu 12.04 and copied to the Debian installation.
Back in Time Installation
Because "Back in time" is not in the Debian repository, you have to install it from the source code (Python based).
Download backintime-1.0.8_src.tar.gz
- Install the program:
# take care about prerequisites $ sudo apt-get install rsync make gettext # unpack the archive $ tar xzf backintime-1.0.8_src.tar.gz $ cd backintime-1.0.8/common # Create Makefile $ ./configure # Install the user part of backintime $ make # install the root parts of backintime $ sudo make install # read the man page $ man backintime # check for version $ backintime -v 1.0.7 # This is hard coded in file: common/config.py (2011-01-05)
Backup Media
The easiest Backup Media is an USB-Stick of 4 GB size or more. The procedure to integrate it in Back in Time is:
# plug in USB-Stick # format to ext4 file system $ sudo mkfs.ext4 /dev/sdb1 # test for file system check (none was set) $ sudo tune2fs -l /dev/sdb1 ... Mount count: 0 Maximum mount count: -1 ... Check interval: 0 (<none>) # setup file system check, every 101 mounts or every 91 days, whatever comes first. $ sudo tune2fs -c 101 -i 91 /dev/sdb1 $ sudo tune2fs -l /dev/sdb1 ... Mount count: 0 Maximum mount count: 101 Last checked: Thu Jan 31 12:08:14 2013 Check interval: 7862400 (3 months, 1 day) Next check after: Thu May 2 13:08:14 2013 # set a label name $ sudo e2label /dev/sdb1 SAVE # make a directory $ sudo mkdir /media/SAVE # mount partition $ sudo mount /dev/sdb1 /media/SAVE # check for mounted $ mount ... /dev/sdb1 on /media/SAVE type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) # in order to mount at boot time edit /etc/fstab # append the line: /dev/sdb1 /media/SAVE ext4 rw,relatime,user_xattr,barrier=1,data=ordered # check for content $ ls /media/SAVE/ lost+found # test with a reboot $ sudo shutdown -r now $ mount ... /dev/sdb1 on /media/SAVE type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
Back in Time use
Only user data and configuration data are saved (/etc, /home and /var). In case not only the /home/user folder is saved, Back in Time must be run with root rights.
# check for total data amount $ du -BK /etc 2108K /etc $ du -BK /home 158292K /home $ du -BK /var 233268K /var # The configuration file is in either (user/root): ~/.config/backintime/config or for root /root/.config/backintime/config # Do the first snapshot $ sudo backintime -b (run with root rights) Back In Time Version: 1.0.7 Back In Time comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; type `backintime --license' for details. INFO: Lock INFO: on process begins INFO: Profile_id: 1 INFO: Call rsync to take the snapshot INFO: Command "rsync -rtDH --links --no-p --no-g --no-o --delete --delete-excluded -v --chmod=Du+wx --exclude="/media/SAVE" --exclude="/root/.local/share/backintime" --include="/etc/" --include="/home/" --include="/var/" --exclude=".gvfs" --exclude=".cache*" --exclude="[Cc]ache*" --exclude=".thumbnails*" --exclude="[Tt]rash*" --exclude="*.backup*" --exclude="*~" --exclude="/root/Ubuntu One" --exclude=".dropbox*" --include="/etc/**" --include="/home/**" --include="/var/**" --exclude="*" / "/media/SAVE/backintime/FADS11/root/1/new_snapshot/backup/" 2>&1" returns 0 INFO: Save config file INFO: Command "cp /root/.config/backintime/config /media/SAVE/backintime/FADS11/root/1/new_snapshot/backup/.." returns 0 INFO: Save permissions INFO: Create info file INFO: Command "chmod -R a-w "/media/SAVE/backintime/FADS11/root/1/20130131-155214-750/backup"" returns 0 INFO: Remove backups older than: 20030131-000000 INFO: [smart remove] considered: ['20130131-155214-750'] INFO: [smart remove] There is only one snapshots, so keep it INFO: Keep min free disk space: 1024 Mb INFO: Unlock $ du -BK /media/SAVE ... 222648K /media/SAVE/
At last setup the root crontab, as explained in the next chapter.
In case of a media change you get a WARNING and no backup:
user.warn backintime (root): WARNING: Can't find snapshots folder ! # to fix it, make the directory $ sudo mkdir -p /media/SAVE/backintime/<hostname>/root/1
root crontab
In order to let Back in time do the job automatically, it can be done with cron. Following you will see how to setup cron with root rights.
# Edit root crontab table $ sudo crontab -e #Back In Time system entry, this was be edited by the GUI: #m h d m wd 0 0 * * * nice -n 19 ionice -c2 -n7 /usr/bin/backintime --backup-job >/dev/null 2>&1 # explanations 0 0 : at midnight nice -n 19 : lowest priority ionice -c2 -n7 : class "best effort", low priority --backup-job take a snapshot (if needed) depending on schedule rules (used for cron jobs) >/dev/null : no output 2>&1 : error output mapped to output # check for setup $ sudo crontab -l ... # m h dom mon dow command # run backintime at midnight 0 0 * * * nice -n 19 ionice -c2 -n7 /usr/bin/backintime --backup-job >/dev/null 2>&1
config file
The settings were read out from the Back in Time GUI:
General: Where to save snapshots: /media/SAVE Schedule: every day, 00:00 (midnight) Include: /etc /home /var Excludes: .gvfs .cache* .thumbnails* .trash* *backup* ~* /root/UbuntuOne .dropbox* Auto-remove: older than: 10 years if free space is less than: 1 GB smart remove: keep all snapshots for at least: 2 days keep one snapshot per day for at least: 7 days keep one snapshot per week for at least: 4 weeks keep one snapshot per month for at least: 24 month keep one snapshot per year for all years Don't remove named snapshots Options: Enable notification Backup files on restore Log level: All Expert options: Run 'nice' as cron job Run 'ionice' as cron job
This is the produced config file, done with the GUI under Ubuntu 12.04. Adopt as needed.
$ cat /root/.config/backintime/config gnome.last_path=/root gnome.main_window.height=532 gnome.main_window.hpaned1=200 gnome.main_window.hpaned2=200 gnome.main_window.width=782 gnome.main_window.x=121 gnome.main_window.y=34 gnome.show_hidden_files=false # #0-manual,10-hourly,20-daily,30-weekly,40-monthly profile1.snapshots.automatic_backup_mode=20 profile1.snapshots.automatic_backup_time=0 profile1.snapshots.backup_on_restore.enabled=true profile1.snapshots.continue_on_errors=false profile1.snapshots.copy_links=false profile1.snapshots.copy_unsafe_links=false profile1.snapshots.cron.ionice=true profile1.snapshots.cron.nice=true profile1.snapshots.dont_remove_named_snapshots=true profile1.snapshots.exclude.1.value=.gvfs profile1.snapshots.exclude.2.value=.cache* profile1.snapshots.exclude.3.value=[Cc]ache* profile1.snapshots.exclude.4.value=.thumbnails* profile1.snapshots.exclude.5.value=[Tt]rash* profile1.snapshots.exclude.6.value=*.backup* profile1.snapshots.exclude.7.value=*~ profile1.snapshots.exclude.8.value=/root/Ubuntu One profile1.snapshots.exclude.9.value=.dropbox* profile1.snapshots.exclude.size=9 profile1.snapshots.include.1.type=0 profile1.snapshots.include.1.value=/etc profile1.snapshots.include.2.type=0 profile1.snapshots.include.2.value=/home profile1.snapshots.include.3.type=0 profile1.snapshots.include.3.value=/var profile1.snapshots.include.size=3 profile1.snapshots.log_level=3 profile1.snapshots.min_free_space.enabled=true # 10=Mb, 20=Gb profile1.snapshots.min_free_space.unit=20 profile1.snapshots.min_free_space.value=1 profile1.snapshots.no_on_battery=false profile1.snapshots.notify.enabled=true profile1.snapshots.path=/media/SAVE profile1.snapshots.path.auto=true profile1.snapshots.path.host=rudiswiki.de profile1.snapshots.path.profile=1 profile1.snapshots.path.user=root profile1.snapshots.preserve_acl=false profile1.snapshots.preserve_xattr=false profile1.snapshots.remove_old_snapshots.enabled=true # 20=days,30=weeks,80=years profile1.snapshots.remove_old_snapshots.unit=80 profile1.snapshots.remove_old_snapshots.value=10 profile1.snapshots.smart_remove=true profile1.snapshots.smart_remove.keep_all=2 profile1.snapshots.smart_remove.keep_one_per_day=7 profile1.snapshots.smart_remove.keep_one_per_month=24 profile1.snapshots.smart_remove.keep_one_per_week=4 profile1.snapshots.use_checksum=false profile1.snapshots.user_backup.ionice=false profiles.version=1
Links
List of pages in this category:
-- RudolfReuter 2013-01-30 19:03:41
Go back to CategoryDockStar or FrontPage ; KontaktEmail (ContactEmail)