LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-10-2009, 07:58 AM   #1
sachinh
Member
 
Registered: Jul 2004
Location: india
Distribution: RH
Posts: 189

Rep: Reputation: 30
Simple tar command


Hello,

Just a simple question about tar.

We have a filesystem,

/
/boot
/usr/users


In order to take the backup of these filesystems, we connected USB drive and mounted under /usb.

Then to get the root backup , I used

tar -cvf root.tar /

And it showed as after few minutes it was taking the backup of /usb contents as well.

Oooops something not expected. Is it a normal behaviour , or we are missing some option here?
How do we avoid this.
In short how do we take the complete filesystem backup excluding specific filesystems?
Please suggest.


Thanks,
 
Old 07-10-2009, 08:02 AM   #2
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
From the tar(1) manpage:

Code:
-l, --one-file-system
              stay in local file system when creating an archive
 
Old 07-10-2009, 08:12 AM   #3
sachinh
Member
 
Registered: Jul 2004
Location: india
Distribution: RH
Posts: 189

Original Poster
Rep: Reputation: 30
Thanx for reply. Do you mean tar -cvfl root.tar / will only take the backup of / and not any filesystem??
Since /usr /opt also reside under / , will it not backup them?

How do we exclude specific filesystem from tar?
 
Old 07-10-2009, 08:25 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Check the man page for --exclude and --exclude-from.
 
Old 07-10-2009, 08:28 AM   #5
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
For that you need to use the --exclude option. e.g.:

Code:
tar -cvf root.tar --exclude /usr
 
  


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
where is TAR ? bash: tar: command not found Juicyapple Linux - Newbie 7 06-10-2009 08:32 AM
tar-command not found while compiling glibc-libidn-2.7.tar.bz2 of lfs6.3 aditya_gpch Linux From Scratch 1 05-13-2008 11:27 PM
[SOLVED] Simple tar based backup command? Bryan88 Linux - Newbie 3 04-21-2007 09:04 AM
Simple Tar Question otisthegbs Linux - Software 1 08-24-2004 01:47 PM
Probably a simple solution 2 a tar question Cruger Programming 6 03-23-2004 09:32 AM

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

All times are GMT -5. The time now is 01:37 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