Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using TAR to backup your Gentoo system
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
my.Gentoo.Asus.Z87-A
n00b
n00b


Joined: 11 Sep 2014
Posts: 7

PostPosted: Wed Oct 22, 2014 4:40 am    Post subject: Using TAR to backup your Gentoo system Reply with quote

Monitor progess with pv - [ monitor the progress of data through a pipe ]

SystemRescueCD has the pv package installed

Here's how i backup/restore my Gentoo system using tar with a progress bar in a SystemCD live environment:
Code:
BACKUP: tar cpf - . | pv -s $(du -sb . | awk '{print $1}') | gzip > <source location>/gentoo-img.tar.gz
RESTORE: pv <source location>/gentoo-img.tar.gz | tar xzpf - -C /mnt/gentoo


Last edited by my.Gentoo.Asus.Z87-A on Thu Oct 23, 2014 10:07 am; edited 3 times in total
Back to top
View user's profile Send private message
my.Gentoo.Asus.Z87-A
n00b
n00b


Joined: 11 Sep 2014
Posts: 7

PostPosted: Wed Oct 22, 2014 4:40 am    Post subject: Reply with quote

Naturally there are many other ways to do this - this is just one for the record... :-)
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2678

PostPosted: Wed Oct 22, 2014 5:16 am    Post subject: Reply with quote

Two major flaws with this script:
Code:
echo "Removing old backups..."
rm /mnt/backup/backups/*.tar.gz
Removing old backups may be an important space saving step, but keeping exactly one backup is slightly problematic. What if the new backup fails? What if the new backup is corrupted? It would make far more sense to keep a number of backups. The coding for this would be slightly more complex, but much better from a backup point of view.

Also, what is the point of keeping backups on the same disk as the main system? If your disk fails it will take everything with it.
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Wed Oct 22, 2014 7:36 am    Post subject: Reply with quote

why not create a stage 4 and backup /home separately? on a regular basis?
Back to top
View user's profile Send private message
my.Gentoo.Asus.Z87-A
n00b
n00b


Joined: 11 Sep 2014
Posts: 7

PostPosted: Wed Oct 22, 2014 1:16 pm    Post subject: Reply with quote

Changed "partitions/disks" to" disks" in the guide. Thanks for pointing out that slip :oops:

As i said above, this is just one way of doing a backup, of course there are others :wink:
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Thu Oct 23, 2014 3:59 am    Post subject: Reply with quote

Nitro wrote:
Provide detailed information about what your tip or trick does, and how it works.
Note: Please do not merely link to another website.
A precis would be welcome.
Back to top
View user's profile Send private message
my.Gentoo.Asus.Z87-A
n00b
n00b


Joined: 11 Sep 2014
Posts: 7

PostPosted: Thu Oct 23, 2014 10:07 am    Post subject: Reply with quote

All cleaned up :wink:
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Thu Oct 23, 2014 2:21 pm    Post subject: Re: Using TAR to backup your Gentoo system Reply with quote

Quote:
Monitor progess with pv - [ monitor the progress of data through a pipe ]

SystemRescueCD has the pv package installed

Hmm nice command; good to know about sys-apps/pv.
Code:
tar cpf - . | pv -s $(du -sb . | awk '{print $1}') | gzip > <source location>/gentoo-img.tar.gz

Code:
.. pv -s "$(du -sb . | cut -f1)" | ..
should be a tiny bit quicker.
You should quote for robustness.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
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