1837390 Members
3534 Online
110116 Solutions
New Discussion

tar backup

 
sudhapage
Regular Advisor

tar backup

Dear all,

I want to take the tar backup of / directory except /var. How I can take it?

Regards,
Sudhakaran.K
8 REPLIES 8
Raj D.
Honored Contributor

Re: tar backup

Sudhapage,

remember / directory also contains non vg00 filesystems , if so it will try to back up those as well.

Find out all the directories under / and specify one by one , excluding var , that will allow you to take the backup without /var.

Ex: # tar -cvf /dir1 /der2 /dir3 ......

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
sudhapage
Regular Advisor

Re: tar backup

In tar command there is no option to exclude some folders?

Regards,
Sudhakaran.K
Dennis Handly
Acclaimed Contributor

Re: tar backup

>Raj: Find out all the directories under / and specify one by one, excluding var

You also need the files directly under /.

You can use this:
# ls -d /!(var)
Raj D.
Honored Contributor

Re: tar backup

Thanks Dennis, good one.

# ls -d /!(var)

This also will not list files but only directories only , excluding var. Though at this point of time, it's good idea to use fbackup ,

Sudhapage, Check this out:
http://www.docs.hp.com/en/B2355-60105/fbackup.1M.html

And check the -e option for exclusion.

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: tar backup

Well, ls -d /!(var) will show the files also , but in a confusing way, as they are directory, hence tar would not work properly,


#ls -d /!(var)

/ACC /bin /home /lost+found /opt /stand /usr
/README /dev /house /mnt /root /terms.txt /var
/acc-beta10.tar.gz /etc /lib /net /sbin /tmp

Here terms.txt and acc-beta10.tar.gz is file, but shows as a directory on root.

Hence its good to use fbackup.

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: tar backup

just found , if you give a space it shows ok.

check this out:

# ls -d / !(var)

# ls -d / !(var)
/ acc-beta10.tar.gz etc lib net sbin tmp
ACC bin home lost+found opt stand usr
README dev house mnt root terms.txt
#



Hence you can use the command as follows:

# tar -cvf /dev/rmt/0mn `ls -d / !(var) | grep -v / | xargs`


Enjoy,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "
Dennis Handly
Acclaimed Contributor

Re: tar backup

>Raj: This also will not list files but only directories only

Sure it will list files. It lists all "files" under / except var. If any of those "files" is a directory, it (-d) doesn't list the content.

>if you give a space it shows ok.

No, this causes it to list the files in the current directory, possibly not "/".
Raj D.
Honored Contributor

Re: tar backup

Thanks Dennis.
Sudhapage any update...??

You must review your threads once posted.!!

" If u think u can , If u think u cannot , - You are always Right . "