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

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.

1 Like

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.

1 Like

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.)

1 Like

There's also the option of piping the archive directly to the other host via ssh.

Regards,
Alister

1 Like

Try

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.

tar cf - file_or_directory... | gzip -c > archive.tar.gz

To list the compressed archive

gunzip -c < archive.tar.gz | tar tf -

To extract some files or everything

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.