Web Hosting Talk







View Full Version : How to handle extremely large tar file?


ckpeter
03-17-2002, 12:39 PM
I use my server to serve videos that are very large. A few weeks ago, my server was hacked, and I had to do a reinstall. I specifically asked my provider to keep the files. The tech who did the resinstall tar'd and zipped the /home directory.

The server is now back online. However, the tar files(unzipped) is about 6.9GB. I tried untar-ing it, but after waiting for 20 minutes, my /home directory was filled, and I think because of this, some files were truncated.

I was hoping to be able to extract individual files out to another partition, maybe /usr temporarily. But I don't know what the command for extracting only some files is. I tried to do a tar --list, but it just hangs there for 5 minutes, and I had to kill it. I know also that there are a few large files in the tar file that I don't need, but I don't know how to delete them from the tarball.(nor do I know their names, since tar --list doesn't work).

My machine is fairly low-end, its a celeron 800 with 128MB of RAM. What would be your recommendation to this problem?

Here is the df output without all the files extracted(but with the large tar file)

------------
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda8 256667 196019 47396 81% /
/dev/hda1 54416 14585 37022 29% /boot
/dev/hda6 12871596 7272012 4945744 60% /home
/dev/hda5 12871596 821464 11396292 7% /usr
/dev/hda7 256667 33005 210410 14% /var
------------

and here is the tar file itself with ls -lhs,

------------
7.0G -rw-r--r-- 1 root root 6.9G Feb 27 14:37 home.tar
------------

Thanks,

Peter

ffeingol
03-17-2002, 02:08 PM
To get a listing of what's in the tar you can do:

tar -tvf home.tar

That will split back everything to your screen. You could also do:

tar -tvf home.tar > home.tar.txt

That will take the output and put it in home.tar.txt

If you have certain files you want to extact, try:

tar -xvf home.tar /extact/path/in/the/tar/file-needed

Try "man tar" on your server to get more details on the tar command.


Frank

ckpeter
03-17-2002, 02:28 PM
Thanks Frank.

Upon examining the output, I found that most of the files are not needed. If I want to expand a certain directory in the tar file, can I use wildcard? Or do I have to expand the files individually?

Thanks,

Peter

ffeingol
03-17-2002, 03:31 PM
A wild card should work, but your milage will vary ;) I've had different amounts of luck depending on the exact tar program that has been installed (i.e. RH vs GNU etc.).

Frank

ckpeter
03-17-2002, 04:09 PM
Thank you. Unfortunately wildcard did not work for me. It is a pain to individually extract the files, since each execution takes about 5 minutes. (Think of the time I will be wasting for the 30 or so files).

Congradulation also on your would-be 500th post.

Peter

ffeingol
03-17-2002, 04:26 PM
Do a "man tar" and let me know if it's gnu tar.

Frank

ckpeter
03-17-2002, 04:48 PM
This is the part of the output:

tar - The GNU version of the tar archiving utility

Peter

bitserve
03-17-2002, 05:40 PM
Your problem is probably that you're trying to use a wildcard. To extract a directory, you don't need a wildcard, just type the name of the directory.

tar -xvf file.tar foo/bar/dir

sample output:

foo/bar/dir/
foo/bar/dir/file1.txt
foo/bar/dir/file2.txt

ckpeter
03-17-2002, 07:29 PM
It turns out wildcard does work. I must have been confused by my ssh client's screen display.

Thanks for all you help!

Peter