Easy Linux Backups

Linux

I have tried most Linux Backup utilities, not all mind you but most of them. In the end I just created a simple perl script that generates and runs a single tar command. dar is a good alternative to tar since it allows splitting compressed files, but for a while dar was incompatible with the version of Ubuntu I was running so I decided tar was a better choice.

Some of the advantages to this simple backup solution.

  1. Make backups while you are working.
  2. Backups are pretty fast and small. My system backs up in under 4 gig, 2 for just the linux system without the home directories.
  3. Restoring does not delete new files, only files in the backup are overwritten.
  4. Easily configurable - modify the script to bakup just your music, movies, virtual OS's, Home dirs etc. This was really important to me because I do not want to backup music and movies when I back up my system. I want to be able to backup/restore just music, movies, home dirs, system etc.

Ok, now for the simple script.


#!/usr/bin/perl;

my $today = `date "+%Y-%m-%d"`;
chomp($today);

#######################################
## CONFIG
# Backup Filename - use $today for date
my $backupfilename = qq[/media/shared/backup/linux/system-backup-$today.tgz];

## Paths to backup
my @include = (
'/',
);

## Paths to exclude (these can be inside the include paths)
my @exclude = (
'/newsys/*',
'/proc/*',
'/lost+found/*',
'/dev/*',
'/mnt/*',
'/media/*',
'/sys/*',
'/tmp/*',
'/home/*',
'*.iso',
);
#####################################
# End Config

my $include = join(' ',@include);
my $exclude = join('" --exclude="',@exclude);
$exclude = qq[--exclude="$exclude"];
$command = qq[sudo tar cvpzf $backupfilename $exclude $include];
print qq[Backup started at $today\n];

## Uncomment to debug;
#print qq[$command\n];
#exit(0);

exec "$command";
print qq[\nBackup Complete\n];

Configure the script

  1. Save the script somewhere like /home/usrername/scripts/system-backup.pl
  2. Change the path in my $backupfilename = qq[/media/shared/backup/linux/system-backup-$today.tgz];
    This is where you want your backups to be stored. $today will be replaced with the current date.
  3. Add the path to the exclude list in this eaxmple the exclude line /media/* takes care of this since the backups is stored under /media/shared
    Note I use a seperate home backup script so I am excluding /home/* , you may not want that.

Running the script

  1. From the script dir type perl system-backup.pl or whatever you saved it as, type in your password when prompted (you must either have sudo access or be running as root).
    If you only run this script as root, you can remove sudo from the line $command = qq[sudo tar cvpzf $backupfilename $exclude $include];
  2. Thats it, if you want to save a log of what is being backed up so you can review it and tweak the exclude list pipe the output to a text file.
    perl system-backup.pl > system-backuplog.txt

Restoring from a Backup

To restore from a backup just type tar xvfz pathtobackup -C dir to restore to.
In the above eaxmple this would be:
tar xvfz /media/shared/backup/linux/system-backup-date.tgz -C /

That is it, enjoy!
I have attached the above script for easy downloading. The attachment has 2 scripts, one for your system and one for your home directory.

 

 


AttachmentSize
backup.tar.gz719 bytes
Comments
(Thanks to everyone who comments)

mini militia

exceptionally good post and i loved it . mini militia game these two are the things that i think you must see mini militia for ios


Payday Loans

Bless you designed for manner material there is always been for a while shared so that you could nation online subscribers. At present go here Payday Loans Bless you designed for writing.


Movie Box APPS For Android

Movie box appis one of the finest Movie streaming application for Android and iOS devices such as iPhone/iPad. Movie Box App Download is available to install Popcorn Time For pcon Android as well as on iPhone/iPad devices without any trouble.Google Allo App Apk Download: The biggest search engine was launched two messaging apps which were the main highlight of the keynote of Google I/O event 2017 those are google allo app and Google Duo. Google Allow Apk is a messaging app that makes you to texting easier and more impressive in a productive manner with its features.


This is my first visit to

This is my first visit to this website am i very happy to read post on this website. You are suel an amazing person. who wrote this type of posts for us. I want to get more like this from here. Thanks for sharing.
http://callmarylandplumber.com/


mulanki

Thanks for such a tremendous response from all.

Tutu Helper Free
Tutu Helper Apk VIP


Aditya

You are so interesting! I don't believe I've truly read through anything like that before. international Women's Day>
So wonderful to discover another person with a few unique thoughts on this issue. Seriously.. many thanks for starting this up. This website is something that is required on the internet, someone with a bit of originality!


result

Val

Are you planned to make a trip to Kanyakumari? Are you looking for the hotels in Kanyakumari near beach? Hotel templeciti is one of the best hotels in Kanyakumari. The staffs in this hotel are supportive.

Valentines Day Images


Freedom apk Freedom

Freedom apk

Freedom apk

Freedom apk

Freedom apk

mygobetx.com adalah bandar Judi Online yang menyediakan aneka taruhan seperti taruhan bola, poker, domino QQ, Ceme, Tangkas dan Aneka permainan slot


University of Jammu Recruitment. RITES Mechanical Engineer Recru

Great post..!! It is very informative. Thanks for sharing this much informative help!
University of Jammu Recruitment
RITES Mechanical Engineer Recruitment


blthuong

Simple yet informative. Thank you for sharing.
I'm admin at:

Thank you for your great post! I love it
I'm admin at:
slither.io kizi game free
friv 10 play time
friv4school three more time
kizi 100 drink game
yoob Rapunzel Baby ShowerRapunzel Baby Shower
friv5 Ariel Baby WashAriel Baby Wash
Click to link and play free 2222 game free: action game - frozen game - io game- racing game - Girl game - shoot game - puzzle game ....


Anna

I can't live without games. And also love this game much. Thank you for your great article.
I'm admin at:

slither.io kizi game pro
friv 10 play time
friv4school teen more time
kizi 100 papa louis game
yoob Baby Super Sparkle InjuryBaby Super Sparkle Injury
friv5 Ariel Baby WashAriel Baby Wash
Click to link and play free 6789 pro game: action game - frozen game - io game- racing game - Girl game - shoot game - puzzle game ....


Punjab 10th Result 2017

All of the students are able to view out PSEB 10th Result 2017 here once announced. Check PSEB 12th Result with roll no. or name wise.


timetable

Time table of all exams held in india.
Nagaland Board 10th Results


up forest guard admit card online

Thats all great advice

up forest guard admit card


Update of IBPS SO Admit Card

Great Work guys!
IBPS SO Admit Card


Need anniversary gift ideas? From the 1st anniversary to the 60

Looking for anniversary gift ideas? With our exclusive range of traditional anniversary gifts you need look no further. Discover now.

anniversary gifts online


agen casino terpercaya

Judi Bola Online , Agen bola terpercaya , agen casino terpercaya, bandar qq online , agen togel terbaik dan terbesar.


sbobet online

mygobetx.com merupakan Bandar Betting Online indonesia terpercaya, Seperti Bandar Bola sbobet online,Judi Bola,Agen bola ayo segera bergabung bersama kami


agen bola terpercaya

mygobetx.com agen bola terpercaya, Agen Casino Sbobet, Agen Judi Online, Agen Tangkas, Bandar Bola Terbaik, Taruhan Judi Bola


judi bola terpercaya

mygobetx.com agen judi bola terpercaya terbesar di Indonesia yang menawarkan fasilitas permainan judi lengkap hanya dengan 1 akun.


agen judi online

Daftar situs agen judi online poker domino online terpercaya di Indonesia lengkap dengan tips-tips menarik dalam bermain berbagai permainan judi online.


agentaruhan

Situs Judi Bola Online melayani agentaruhan Bola, SBOBET Casino & IBCBET Online di Indonesia


bandar bola sbobet

mygobetx.com - bandar bola sbobet,agen bola, betting sbobet, ibcbet, judi togel klik4d, tangkasnet, poker, 168gdc, casino 338a, taruhan bola online terpercaya.


sbobet casino

Situs LIVE Games Online Terpercaya Dengan Minimal Deposit Hanya RP 50ribu Dan Rasakan Sensasi Bermain sbobet casino Sebenarnya.


judi online bola

mygobetx.com Situs judi online bola Indonesia, Agen Casino & Agen Bola SBOBET Terpercaya.


agen bola online

mygobetx.com merupakan Bandar Betting Online indonesia terpercaya, Seperti Bandar Bola sbobet Online,Judi Bola,agen bola online ayo segera bergabung bersama kami


pasaran bola

mygobetx.com penyedia situs judi bola online yang memiliki pasaran bola yang kompetitif dan setara dengan SBOBET, M88, liga365 dan IBCBet


bola bet

bola bet menyajikan kabar info berita dunia bola sepak terbaru terhangat nasional dan internasional terkini di indonesia.


agen sbobet

mygobetx.com - agen sbobet dan Bandar Taruhan Judi Bola Online tersedia aneka games Sportbook, Live Casino, Togel, Poker Online DLL. 1 ID untuk semua games.


dunia bola

bola bet menyajikan kabar info berita dunia bola sepak terbaru terhangat nasional dan internasional terkini di indonesia.


bandar judi bola terpercaya

mygobetx.com adalah bandar judi bola terpercaya dan Taruhan bola Online terpercaya.


situs bola

mygobetx.com bandar situs bola Terpercaya Di Indonesia yang dilengkapi Dengan Cs Ramah Untuk Melayani Anda 24 Jam NON Stop.


agen taruhan bola online

mygobetx.com adalah Bandar agen taruhan bola online terbesar yang mempunyai pasaran sendiri, pasaran terbaik di asia.


situs bola terpercaya

mygobetx.com bandar situs bola terpercaya Di Indonesia yang dilengkapi Dengan Cs Ramah Untuk Melayani Anda 24 Jam NON Stop.


Bola sbobet

mygobetx.com merupakan Bandar Betting Online indonesia terpercaya, Seperti Bandar Bola sbobet Online,Judi Bola,Agen bola ayo segera bergabung bersama kami


bandar bola online

mygobetx.com adalah bandar bola online yang menyediakan aneka taruhan seperti taruhan bola, poker, domino QQ, Ceme, Tangkas dan Aneka permainan slot


Judi bola Online

mygobetx.com agen situs Judi bola Online terpercaya terbesar di Indonesia yang menawarkan fasilitas permainan judi lengkap hanya dengan 1 akun.


agen judi bola terpercaya

mygobetx.com adalah Web agen judi bola terpercaya Bandar Judi Online Agen Casino Terbesar dan Terpercaya.


bandar online

bandar online adalah bandar bola, casino, tangkas, hasil togel dan poker online terpercaya. Minimal deposit 50 ribu.


agen sbobet indonesia terpercaya

Mygobetx.com sudah menjalani kiprahnya sebagai agen sbobet indonesia terpercaya selama bertahun-tahun belakangan ini.


master agen bola

Panduan lengkap untuk mengakses akun member yang telah bergabung dengan master agen bola disini.


situs judi bola terbesar

agen situs judi bola terbesar dan terpercaya di Indonesia yang menawarkan fasilitas permainan judi lengkap hanya dengan 1 akun.


sbobet 88

bola sbobet 88 online dan terpercaya akan membawa anda pada kekayaan yang lumayan besar dan sangat maksimal.


agen judi bola terbaik

Agen Judi bola, agen judi bola terbaik, agen bola terpercaya, bandar bola, agen sbobet, agen casino, agen bola tangkas, agen togel, bandar taruhan bola


pasaran judi bola

Semua bursa bola yang ada disini akan secara otomatis berganti setiap harinya menyesuaikan pasaran judi bola yang berlaku pada hari ini di setiap situs


prediksi bandar bola

prediksi bandar bola hari ini berikut info jitu tips dan skor yang pertama di Indonesia, meliput beragam pertandingan sepakbola


Post new comment

More information about formatting options