$which tar
/bin/tar
$ cd /u01/app NOTE: do not have /u01/app in front of folder name EBSDEV below
$ tar -zcvf /u04/app/backup/m3d_DEV_022015_mt.tar.gz EBSDEV >> /u04/app/ebsde v_backup/backup022015.log
tar: EBSDEV/apps/apps_st/appl/aagl/bin/.sasa.swp: Cannot open: Permission denied
tar: EBSDEV/apps/apps_st/appl/docs/install/.vi_v_pkb.sql.swp: Cannot open: Permission denied
tar: EBSDEV/apps/apps_st/appl/aafs/bin/fssd01_old: Cannot stat: No such file or directory
tar: EBSDEV/apps/apps_st/appl/aafs/bin/text.txt: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
To get detail on above errors, use "ls -al" to find that /u01/app/EBSDEV/apps/apps_st/appl/aagl/bin/.sasa.swp is owned by a different OS user, and find file link is missing /u01/app/EBSDEV/apps/apps_st/appl/aafs/bin/fssd01_old -> /bin/fndcpesr, etc.
NOTES:
1. If "-h" is used (e.g. tar -zhcvf ...), it ditches the symlinks and copies/brings in the actual files they pointed to. Without '-h", it retains the soft links.
2. It can back up multiple folders to one file. It is useful in R12.2.
2. It can back up multiple folders to one file. It is useful in R12.2.
$ cd /u04/app/EBSDEV
$ tar -zcvf /u04/app/backup/m3d_DEV_beforeSSL.tar.gz fs1 fs2 fs_ne EBSapps.env >> /u04/app/backup/backup1005.log
$ mkdir temp
$ cd temp
$ tar vzxfp /path/to/m3d_DEV_022015_mt.tar.gz
It will create folder EBSDEV under current folder /temp/
The options stand for verbose, extract, pass thru gzip first, specify file, preserve permissions. "p" is important when trying to restore a directory.
Now, "find EBSDEV -type f | wc -l" shall match the counts on source and target folders. With "-type f", find does not count symlinks (symbolic link).
BTW, zip also can be used to backup a (smaller) folder:
$ zip -r flie_name.zip folder_name
"-r" is to get all subfolders.
gzip can be used to compress a big file (but it is slow):
$ ls -al java*.*
-rw------- 1 user group 5842435627 Jan 18 12:07 java_pid1583.hpro
$ gzip java_pid1583.hprof
$ ls -al java*.*
-rw------- 1 user group 697002093 Jan 18 12:07 java_pid1583.hprof.gz
$ which gzip
/usr/bin/gzip
No comments:
Post a Comment