LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-18-2010, 11:37 PM   #1
muvendrann
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Rep: Reputation: 15
restoring the particular directory from tar


Hi,

I have performed the tar backup in my linuxbox by using the command


tar -cvpzf ring.tar.gz /m01/fordb/sql


The ring.tar.gz is stored in /m01


Now i need to restore the particular directory sql into the /m01/fordb/

where i have deleted the sql directory


can any one help me pls
 
Old 06-19-2010, 12:14 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Include the path for the sql directory backed up as an argument to the tar command. Only the sql directory will be backed up. Either cd to the same directory where you ran tar from originally (the base directory) or use the -C <base_directory> argument.
tar -C / -xvzf /path/to/ring.tar.gz /m01/fordb/sql

The example you gave, you are extracting the entire contents of the backup you made. If you had backed up /m01/fordb/* you could restore just the /m01/fordb/sql directory alone with the above command. Cd'ing to / and extracting without a directory argument would do the same thing in this particular case.
 
Old 06-19-2010, 12:48 AM   #3
muvendrann
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks,

If i need to take tar backup of only the sql folder from the following path /m01/fordb/sql into the location /m01

What is the command needed
 
Old 06-19-2010, 01:19 AM   #4
junust
Member
 
Registered: Jul 2008
Location: Israel Ramat Gan
Distribution: CentOs 5.3, SuSe 11.1, Solaris 9, Slackware 13
Posts: 81

Rep: Reputation: 15
tar --extract --file=TAR_ARCH.tar.gz PATHtoTHEfolder_to_extract inside the tar
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
restoring ONLY the home directory from a complete tar backup irishbitte Linux - Server 5 11-11-2008 08:24 AM
restoring desktop directory in /root (or any home directory) mel_lai Linux - Newbie 3 02-04-2008 03:13 AM
restoring from tar reeseslover531 Linux - Software 3 11-08-2006 06:51 PM
Help restoring from tape and tar...... TheDirtyPenguin Linux - Software 1 02-17-2004 07:42 AM
restoring /etc files from tar backup hdagelic Linux - General 1 09-24-2003 07:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration