1819871 Members
2636 Online
109607 Solutions
New Discussion юеВ

tar 1.5.1 problem

 
SOLVED
Go to solution
boomer_2
Super Advisor

tar 1.5.1 problem

Hi guys,
I have tar 1.5.1 installed from one of my forum thread..for gnu tar utility to take a tar of more than 2 gb...
but when i run tar -cvf test.tar /home which is 5 gb in size the tar file is cretaed but the file is not compressed..the same file size of 5 tar is getting formed..what should i do??
23 REPLIES 23
Peter Godron
Honored Contributor

Re: tar 1.5.1 problem

Hi,
tar is an archiving method not a compression tool!

use tools like compress, gzip ... for compression of the files.

See:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1053335
and the last answer in
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=775222

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Robert-Jan Goossens_1
Honored Contributor

Re: tar 1.5.1 problem

Hi,

Try adding the z option.

# gtar cvzf test.tar.gz /home

Regards,
Robert-Jan
Indrajit_1
Valued Contributor

Re: tar 1.5.1 problem

Hi;

You can zip the file using gzip command

#gzip file_name.

If it is a directoy, then tar the directory and then zip the file

#tar -cvf dir.tar dir
#gzip dir.tar
You can also use gtar command.

Cheers;
Indrajit Roy
Never Ever Give Up
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Hi Indrajit,
im not able to find gtar command in my server....
Rasheed Tamton
Honored Contributor

Re: tar 1.5.1 problem

Hi,

It is already mentioned.
Still, for clarity here is the full path for gzip.

1.

/usr/contrib/bin/gzip test.tar

(filename of the tar - in your case test.tar)

2.
compress test.tar

Regards,
Rasheed Tamton.
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Hi rasheed,
I think my questn is not clear...
what i mean to ask u guys is that after creating a tar archive should my directory size be reduced ? and if yes then to what extent ..by how many % ?
And second thing i have installed gnu tar since i need to take a tar of 5gb directory.. from http://hpux.connect.org.uk/hppd/hpux/ as a result of which im not able to find gtar command in my server..i doubt whether gnu tar has been properly installed...
Dennis Handly
Acclaimed Contributor

Re: tar 1.5.1 problem

>after creating a tar archive should my directory size be reduced?

Your original files may be increased if they had holes in them and when tar reads them, it would fill in these holes.

The size of the archive should be the sum of the files plus overhead. Only when compressing would you have a reduced size.

gnu tar is just probably called tar and not gtar. Typically if you want to make sure you keep your foreign devil tools separate from HP's, you use g* as the name.
Rasheed Tamton
Honored Contributor

Re: tar 1.5.1 problem

Hi Boomer,

/usr/local/bin/gtar - it should be the default location.

or try to find

find /usr -name gtar

or any dir where you think this might have gone in.

Reg. the reduction of the size, as far as I noticed, normally it should not impact.
Tar as a tool is used for archiving/backing up or moving files around from systems to systems, etc. It is not meant anyway for anyway of compression.


Regards,
Rasheed Tamton.
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Hi rasheed,
no gtar found on my server..
Eric Jacklin
Regular Advisor
Solution

Re: tar 1.5.1 problem

can you please share which files are you going to compress.

If it is in compress mode then it will not requced my size
Dennis Handly
Acclaimed Contributor

Re: tar 1.5.1 problem

>no gtar found on my server..

To make it clear, does /usr/local/bin/tar support the -z or --gzip option?

Use /usr/local/bin/tar --help
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Hi Dennis,
# /usr/local/bin/tar --help
Usage: tar [OPTION...] [FILE]...
GNU `tar' saves many files together into a single tape or disk archive, and can
restore individual files from the archive.

Examples:
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar # Extract all files from archive.tar.

Main operation mode:

-A, --catenate, --concatenate append tar files to an archive
-c, --create create a new archive
--delete delete from the archive (not on mag tapes!)
-d, --diff, --compare find differences between archive and file system
-r, --append append files to the end of an archive
-t, --list list the contents of an archive
-u, --update only append files newer than copy in archive
-x, --extract, --get extract files from an archive

Operation modifiers:

-g, --listed-incremental=FILE handle new GNU-format incremental backup
-G, --incremental handle old GNU-format incremental backup
--ignore-failed-read do not exit with nonzero on unreadable files
-k, --keep-old-files don't replace existing files when extracting
--keep-newer-files don't replace existing files that are newer than
their archive copies
-n, --seek Archive is seekable
--no-overwrite-dir preserve metadata of existing directories
--occurrence[=NUMBER] process only the NUMth occurrence of each file in
the archive. This option is valid only in
conjunction with one of the subcommands --delete,
--diff, --extract or --list and when a list of
files is given either on the command line or via
-T option. NUMBER defaults to 1.
--overwrite overwrite existing files when extracting
-O, --to-stdout extract files to standard output
--recursive-unlink empty hierarchies prior to extracting directory
--remove-files remove files after adding them to the archive
-S, --sparse handle sparse files efficiently
-U, --unlink-first remove each file prior to extracting over it
-W, --verify attempt to verify the archive after writing it

Handling of file attributes:

--atime-preserve don't change access times on dumped files
--group=NAME force NAME as group for added files
--mode=CHANGES force (symbolic) mode CHANGES for added files
-m, --touch don't extract file modified time
--no-same-owner extract files as yourself
--no-same-permissions do not extract permissions information
--numeric-owner always use numbers for user/group names
--owner=NAME force NAME as owner for added files
-p, --preserve-permissions, --same-permissions
extract permissions information
--preserve same as both -p and -s
-s, --preserve-order, --same-order
sort names to extract to match archive
--same-owner try extracting files with the same ownership

Device selection and switching:

-f, --file=ARCHIVE use archive file or device ARCHIVE
--force-local archive file is local even if has a colon
-F, --info-script=NAME, --new-volume-script=NAME
run script at end of each tape (implies -M)
-L, --tape-length=NUMBER change tape after writing NUMBER x 1024 bytes
-M, --multi-volume create/list/extract multi-volume archive
--rmt-command=COMMAND use given rmt COMMAND instead of rmt
--rsh-command=COMMAND use remote COMMAND instead of rsh
--volno-file=FILE use/update the volume number in FILE

Device blocking:

-b, --blocking-factor=BLOCKS BLOCKS x 512 bytes per record
-B, --read-full-records reblock as we read (for 4.2BSD pipes)
-i, --ignore-zeros ignore zeroed blocks in archive (means EOF)
--record-size=NUMBER SIZE bytes per record, multiple of 512

Archive format selection:

-H, --format=FORMAT create archive of the given format.

FORMAT is one of the following:

gnu GNU tar 1.13.x format
oldgnu GNU format as per tar <= 1.12
pax POSIX 1003.1-2001 (pax) format
posix Same as pax
ustar POSIX 1003.1-1988 (ustar) format
v7 old V7 tar format

-j, --bzip2 filter the archive through bzip2
--old-archive, --portability
same as --format=v7
--pax-option=keyword[[:]=value][,keyword[[:]=value], ...]
control pax keywords
--posix same as --format=posix
--use-compress-program=PROG
filter through PROG (must accept -d)
-V, --label=TEXT create archive with volume name NAME. At
list/extract time, use TEXT as a globbing pattern
-z, --gzip, --gunzip, --ungzip filter the archive through gzip
-Z, --compress, --uncompress filter the archive through compress

Local file selection:

--after-date=DATE same as -N
--anchored exclude patterns match file name start
--backup[=CONTROL] backup before removal, choose version CONTROL
-C, --directory=DIR change to directory DIR
--exclude=PATTERN exclude files, given as a PATTERN
--exclude-caches exclude directories containing a cache tag
-h, --dereference dump instead the files symlinks point to
--ignore-case exclusion ignores case
-K, --starting-file=MEMBER-NAME
begin at member MEMBER-NAME in the archive
--newer-mtime=DATE compare date and time when data changed only
--no-anchored exclude patterns match after any / (default)
--no-ignore-case exclusion is case sensitive (default)
--no-recursion avoid descending automatically in directories
--no-wildcards exclude patterns are plain strings
--no-wildcards-match-slash exclude pattern wildcards do not match '/'
--null -T reads null-terminated names, disable -C
-N, --newer=DATE-OR-FILE only store files newer than DATE-OR-FILE
--one-file-system stay in local file system when creating archive
-P, --absolute-names don't strip leading `/'s from file names
--recursion recurse into directories (default)
--strip-components=NUMBER strip NUMBER leading components from file
names
--suffix=STRING backup before removal, override usual suffix ('~'
unless overridden by environment variable
SIMPLE_BACKUP_SUFFIX
-T, --files-from=FILE-OF-NAMES get names to extract or create from file
NAME
--wildcards exclude patterns use wildcards (default)
--wildcards-match-slash exclude pattern wildcards match '/' (default)
-X, --exclude-from=FILE exclude patterns listed in FILE

Informative output:

--checkpoint display progress messages every 10th record
-v, --verbose verbosely list files processed

--check-links print a message if not all links are dumped
--index-file=FILE send verbose output to FILE
-R, --block-number show block number within archive with each
message
--show-defaults Show tar defaults
--show-omitted-dirs When listing or extracting, list each directory
that does not match search criteria
--totals print total bytes written while creating archive
--utc print file modification dates in UTC
-w, --interactive, --confirmation
ask for confirmation for every action

Compatibility options:

-o when creating, same as --old-archive. When
extracting, same as --no-same-owner

Other options:

-?, --help Give this help list
--license Print license and exit
--usage Give a short usage message
--version Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control may be set with --backup or VERSION_CONTROL, values are:

t, numbered make numbered backups
nil, existing numbered if numbered backups exist, simple otherwise
never, simple always make simple backups

*This* tar defaults to:
--format=gnu -f- -b20 --rmt-command=/usr/local/bin/rmt --rsh-command=/usr/bin/remsh

Report bugs to .

when i do tar -cvzf i get an error illegal option....
Steven Schweda
Honored Contributor

Re: tar 1.5.1 problem

So, let me see if I followed this. If you
ask for usage information from
/usr/local/bin/tar
it talks about "-z", but if you use
tar -z
it fails?

Have you considered using
/usr/local/bin/tar -z
instead of
tar -z
???

Time for "Introduction to UNIX"?
Steven Schweda
Honored Contributor

Re: tar 1.5.1 problem

And, for the record, before any "tar" offered
a "-z" option, this kind of thing was done
using a pipeline, like:

tar cf - file_list | gzip - > archive.tgz

or:

gzip -c -d archive.tgz | tar xfo -

Or somethings like those.

The fancy options in GNU "tar" hide this
stuff, but it's nice to know.
Dennis Handly
Acclaimed Contributor

Re: tar 1.5.1 problem

>when i do tar -cvzf i get an error illegal option....

That's why you rename this file (or create a symlink) to gtar, so you can keep them straight.
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Hi Steven,
I want to take a tar of mount point which is 5 gb in size...and at the same time i want to compress it....
For ex:
/test - 5gb
i would like to tar this mount point plus compress it anohter mount point which is 6gb only...how can i fit it into thta mount point
bcoz tar and gzip take place in the same mount point simultaneously....
Steven Schweda
Honored Contributor

Re: tar 1.5.1 problem

If I understand what you want (which I may
not) ...

If the source file system is at "/src", and
the destination is "/dst", I might try
something like:

( cd /src ; tar cf - . ) | gzip -c > /dst/src.tgz

Do you want the compressed "tar" archive at
the destination, or did you want to unpack
the archive at the destination? (Do you want
"/dst/src.tgz", or do you want all the files
from "/src" to be copied to "/dst"?)
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Ya steven i want all the files
from "/src" to be copied to "/dst"?)
space being 5gb in src ansd 6gb in dst.
Steven Schweda
Honored Contributor

Re: tar 1.5.1 problem

> i want all the files
> from "/src" to be copied to "/dst"?

This is how you should have started this
thread. It's often easy to explain how to
solve a problem. It's often hard to explain
how to implement the wrong solution to that
problem.


So why compress? You can, but you don't
need to. What you _do_ need is a "tar"
pipeline (or a cpio pipeline, or a
dump-restore pipeline, or ...). For example:

( cd /src ; tar cf - . ) | \
( cd /dst ; tar xfo - )

Of course, you need to get the right "tar",
as covered earlier.

If you have fast CPUs and a slow network, it
might make sense to add compression, like,
for example:

( cd /src ; tar cf - . | gzip -c ) | \
( cd /dst ; gzip -c -d | tar xfo - )

This type of question seems to be popular.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1111049

Because this is all new stuff, you should
probably run a few experiments on small
directories, to see how it works, before
doing the big job.
Steven Schweda
Honored Contributor

Re: tar 1.5.1 problem

It can also be educational to add a "-v" to
one "tar" command or the other. (If you add
"-v' to both "tar" commands, the mixed output
can be more confusing than helpful.)
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Ok Steven,
thanx for the explaination...........points given to you.
boomer_2
Super Advisor

Re: tar 1.5.1 problem

Thanks steven i m finally a learned person now...
Steven Schweda
Honored Contributor

Re: tar 1.5.1 problem

Perhaps not quite yet, but progress is
progress, and that's better than no progress.
When I learn everything, I'll be sure to
announce it here. (Don't hold your breath.)