Backup and restore using tar | Unix Linux Forums | Red Hat

  Go Back    


Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions.

Backup and restore using tar

Red Hat


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-21-2013
Tommyk Tommyk is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 24 September 2014, 7:12 AM EDT
Location: Ripon, North Yorkshire
Posts: 146
Thanks: 4
Thanked 14 Times in 14 Posts
Backup and restore using tar

This will be covered elsewhere im sure but i just cant seem to find my exact issue.

I want to backup my systems using tar, command is:


Code:
tar -cjpf /backup /bin /etc /home /opt /root /sbin /usr /var /boot

When i include the / directory it also tar's the /lib /sys /proc /dev filesystems too (and more but these seem to be problem directories.)

Although i have never tried to restore the /sys /proc and /dev directories I have not seen anyone mention that your cant restore /lib but when i tried the server crashed and would not even start the kernel (not even in single user mode).

Can anyone let me know why this happened and provide a more comprehensive list of directories than the 4 mentioned as to what should and shouldn't be backed up and restored? Or point me to a useful site that might explain why you should or shouldn't backup each one?
Sponsored Links
    #2  
Old 01-21-2013
Peasant's Avatar
Peasant Peasant is offline
Registered User
 
Join Date: Mar 2011
Last Activity: 30 October 2014, 10:28 AM EDT
Posts: 668
Thanks: 18
Thanked 150 Times in 146 Posts
You should exclude virtual filesystems (sys, proc).

Read about filesystem hierarchy standard for more information about above.
Filesystem Hierarchy Standard - Wikipedia, the free encyclopedia

Here is also a good link from ubuntu forums which can be applied in this case :
Howto: Backup and restore your system! - Ubuntu Forums
Sponsored Links
    #3  
Old 01-21-2013
hicksd8 hicksd8 is offline Forum Advisor  
Registered User
 
Join Date: Feb 2012
Last Activity: 30 October 2014, 5:26 PM EDT
Location: Cornwall, UK
Posts: 840
Thanks: 44
Thanked 158 Times in 143 Posts
There's no point in backing-up things like /proc because that's the dynamic handling of processes and memory working sets (virtual memory).

However, directories like /lib, although problematic to restore on a running system, you would definitely need them in a disaster recovery situation. You would restore /lib to hard disk in single user or cd boot mode.

So you need to backup all non-process, non-memory files for the backup to be sufficient to recover. It doesn't mean, however, that you should attempt to restore them on a running (multi-user) system.

Full Hard-Drive Backup with Linux Tar
    #4  
Old 01-21-2013
Tommyk Tommyk is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 24 September 2014, 7:12 AM EDT
Location: Ripon, North Yorkshire
Posts: 146
Thanks: 4
Thanked 14 Times in 14 Posts
Yes sorry i excluded the /proc /sys and /dev filesystems.

I will attempt to do a restore in single user mode next time then. I did think the /lib, /lib64 ..etc directories were required but after multiple attempts and the server dying each time i was wondering if i was missing something.

Cheers for your help guys, I had read those links you attached but none of them mentioned single user or cd-boot mode being required.
Sponsored Links
    #5  
Old 01-21-2013
hicksd8 hicksd8 is offline Forum Advisor  
Registered User
 
Join Date: Feb 2012
Last Activity: 30 October 2014, 5:26 PM EDT
Location: Cornwall, UK
Posts: 840
Thanks: 44
Thanked 158 Times in 143 Posts
In a recovery situation you will need /dev backed-up.

Again, you wouldn't restore /dev on a running system.
Sponsored Links
    #6  
Old 01-21-2013
Tommyk Tommyk is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 24 September 2014, 7:12 AM EDT
Location: Ripon, North Yorkshire
Posts: 146
Thanks: 4
Thanked 14 Times in 14 Posts
If we take an example of one of our Linux servers, it is running on an HP BL460c G7 blade, in a DR situation we would e restoring this onto a DL380 server.

Although never fully tested with Linux the idea was that we would have the DL380 server setup with the same version of Linux OEL5.5 and all the filesystems and partitions already setup with the same sizes.

So from the information above take the tarball and in single user mode unpack it. In this instance would we need the /dev directory?

Unfortunately this is something i have only had 5 working days to trial before and because of doing other work and the legth of time it took couldn't get it working, and now i have no spare hardware to test on but we are doing a DR trial soon and it is going to be important to get working. The more info i get the quicker i can hopefully overcome any issues i run into on the trial.
Sponsored Links
    #7  
Old 01-21-2013
hicksd8 hicksd8 is offline Forum Advisor  
Registered User
 
Join Date: Feb 2012
Last Activity: 30 October 2014, 5:26 PM EDT
Location: Cornwall, UK
Posts: 840
Thanks: 44
Thanked 158 Times in 143 Posts
The /dev directory holds the device nodes for the hardware. It is the connection between the O/S and the actual hardware (eg, /dev/sda being a disk drive).

When you restore a backup to different hardware, these devices will be wrong for that hardware and will need to be rebuilt/reset to suit. I'm not a RedHat expert so I don't know exactly how that would be achieved. Perhaps RedHat experts on this forum can tell us how to restore to different hardware.

Anyway, the point is you need to backup all hard disk directories and ignore the directories which are really pseudo memory (eg, /proc). You need to distinguish between the two.

Work on the principle that it is better to have a backup containing stuff that is unnecessary and/or needs modification to suit new hardware rather than not have a copy of it at all.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Backup / Restore Duffs22 Red Hat 6 07-17-2012 10:23 AM
F-Backup restore paultittel HP-UX 3 06-27-2006 09:46 AM
Backup and restore uXion AIX 3 06-25-2006 09:02 PM
Backup / restore tt155 Solaris 4 01-22-2006 12:39 PM
Cannot restore a TAR backup Ross.Goodman UNIX for Dummies Questions & Answers 2 10-20-2000 04:52 AM



All times are GMT -4. The time now is 06:55 PM.