Tar file creation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Tar file creation
# 1  
Old 05-06-2013
Tar file creation

Hi,
I need to transfer some files from one server to another server.

I need confirmation whether tar file will be created or not in HP UX with the following space details.

du -s /home/webadmin/xxx/bin/

469186 /home/webadmin/xxx/bin/

df -k /home/webadmin/xxx/bin/

556110 total allocated Kb
260411 free allocated Kb
295699 used allocated Kb
53 % allocation used

The value of du is in 512-byte blocks, so after diving by 2 , the value in kb is
234593 kb.

Shall i able to create a tar file?

If enough space is not available, what tar command will do?

Thanks
# 2  
Old 05-06-2013
I think it's possible if your filesystem supports large files. Some versions of tar have a size limit, but the limit is on the size of an individual file -- not the total number of bytes. And that looks well below it(8 gigs if I remember right).

But it will be a tight squeeze and can't be guaranteed, especially if your system reserves a percentage of blocks for root.

If it runs out of space, it will quit with error and leave the half-finished file.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 05-06-2013
Quote:
If enough space is not available, what tar command will do?
In that case, I would try using rsync to transfer the files.

Or, you could create a tar file with files / dirs starting with a-m, transfer it, delete it, then make another for those starting with n-z, transfer it.
This User Gave Thanks to hanson44 For This Post:
# 4  
Old 05-06-2013
Note that if tar runs out of space, the archive can still be used to transfer all of the files that had been placed in the archive before it ran out of space. Then you can remove the tar file and restart with the file it was archiving when it ran out of space. (Of course if you do it this way, other people may not be able to create files until you have transferred that partial tar archive and removed it from the local host. And there is also the possibility that you won't be able to transfer the archive if you're out of space.)
This User Gave Thanks to Don Cragun For This Post:
# 5  
Old 05-06-2013
There's also the option of piping the archive directly to the other host via ssh.

Regards,
Alister
This User Gave Thanks to alister For This Post:
# 6  
Old 05-07-2013
Try
Code:
du -sk

that would be in kbytes.

Try to compress your tar file. An extra step is needed, but a pipe avoids an intermediate file and extra temporary space.
Code:
tar cf - file_or_directory... | gzip -c > archive.tar.gz

To list the compressed archive
Code:
gunzip -c < archive.tar.gz | tar tf -

To extract some files or everything
Code:
gunzip -c < archive.tar.gz | tar xvf - file_or_directory_from_archive...
gunzip -c < archive.tar.gz | tar xvf -

If your system does not have gzip/gunzip use compress/uncompress instead; the archive should be named archive.tar.Z then.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Tar - pre-checking before making the Tar file

Coming from this thread, just wondering if there is an option to check if the Tar of the files/directory will be without any file-errors without actually making the tar. Scenario: Let's say you have a directory of 20GB, but you don't have the space to make Tar file at the moment, and you want... (14 Replies)
Discussion started by: filosophizer
14 Replies

2. UNIX for Dummies Questions & Answers

UNIX command to check if file name ends with .tar OR if the file is a tar file

Hello Team, Would you please help me with a UNIX command that would check if file is a tar file. if we dont have that , can you help me with UNIX command that would check if file ends with .tar Thanks in advance. (10 Replies)
Discussion started by: sanjaydubey2006
10 Replies

3. Red Hat

Trouble with .tar creation over NFS mount

Hello, I am trying to backup a directory to an NFS mount. But after mounting the "tar" command is failing. 1. Created folder for mount point: test1 2. Mounted desired mount: # mount -t nfs server_name2:/backup/WMSAPP_backup -w /test1/ # df -h Filesystem Size Used Avail Use%... (5 Replies)
Discussion started by: ikn3
5 Replies

4. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

5. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

6. UNIX for Advanced & Expert Users

Tar utility (untar a .tar file) on VxWorks

Hi All Can someone pls guide me if there any utility to compress file on windows & uncompress on vxworks I tried as - - compressed some folders on windows ... i created .tar ( to maintain directory structure ) and compressed to .gz format. - on VxWorks i have uncompressed it to .tar... (1 Reply)
Discussion started by: uday_01
1 Replies

7. Shell Programming and Scripting

extract one file form .tar.gz without uncompressing .tar.gz file

hi all, kindly help me how to extract one file form .tar.gz without uncompressing .tar.gz file. thanks in advance bali (2 Replies)
Discussion started by: balireddy_77
2 Replies

8. UNIX for Advanced & Expert Users

deleting files after the creation of a tar archive

Hi, I would modify to delete the files after creating the tar archive. How I can modify the following command: tar -cvvf logswitch.tar `find *.log* -mtime +5` It create a tar with files that are older than 5 days. (5 Replies)
Discussion started by: Minguccio75
5 Replies

9. UNIX for Advanced & Expert Users

Does tar do crc checking on a tape or tar file?

Trying to answer a question about whether tar table-of-contents is a good tool for verifying tape data. (1 Reply)
Discussion started by: tjlst15
1 Replies

10. Shell Programming and Scripting

Creation and Transfer of TAR file from one machine to another Using UNIX script

Hi, I want to create unix script such that it should run on machine A, it should run TAR commands on machine B and copy that TAR to machine C. Is it possible? Thanks Rahul (2 Replies)
Discussion started by: rahuljadhav
2 Replies
Login or Register to Ask a Question