Page 1 of 1
command line compression?
Posted: Tue Jul 13, 2004 12:27 am
by Red Squirrel
Is it possible to compress files (ex: make a folder a black hole archive) via command line? If yes how do I do it, and how do I extract it? My server drive is getting nearly full so I want to start archiving stuff. I'm hoping to be able to make black hole archives as they are 50% the original size which beats mostly all other compression methods but if that's not possible then anything will do.
Archived topic from Anythingforums, old topic ID:495, old post ID:4360
command line compression?
Posted: Tue Jul 13, 2004 1:43 am
by megaspaz
Red Squirrel wrote: Is it possible to compress files (ex: make a folder a black hole archive) via command line? If yes how do I do it, and how do I extract it? My server drive is getting nearly full so I want to start archiving stuff. I'm hoping to be able to make black hole archives as they are 50% the original size which beats mostly all other compression methods but if that's not possible then anything will do.
man tar
Archived topic from Anythingforums, old topic ID:495, old post ID:4365
command line compression?
Posted: Tue Jul 13, 2004 3:33 am
by wldkos
a black hole???
+1 on the "man tar"
im sure well get questions on how to use it though, which is fine.
Archived topic from Anythingforums, old topic ID:495, old post ID:4374
command line compression?
Posted: Tue Jul 13, 2004 9:33 am
by Red Squirrel
After second try I got it working but there's like hardly any compression on tars, so is there a different way? Black holes are incredible archives, you can get some folders down to like 10% the original size, depending on what's in it. Usually it's 50% but the few last folders I did locally I turned 1GB of data to like 50 megs lol... all logs and easy to compress files.
Archived topic from Anythingforums, old topic ID:495, old post ID:4377
command line compression?
Posted: Tue Jul 13, 2004 2:24 pm
by megaspaz
use the -j or -z options with tar. -j will use the bzip compression and -z will use the gzip compression.
Archived topic from Anythingforums, old topic ID:495, old post ID:4397
command line compression?
Posted: Tue Jul 13, 2004 2:26 pm
by megaspaz
does going from 71.3 MB down to 28.2 MB count as a black hole?
that's using the gzip compression on my home directory.
Archived topic from Anythingforums, old topic ID:495, old post ID:4398
command line compression?
Posted: Tue Jul 13, 2004 2:31 pm
by Red Squirrel
Well that's pretty good I'll go with that then.
How to I fix this error though?
[root@localhost day_backup]# tar -cfz local.tar local.old
tar: local.tar: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
[root@localhost day_backup]#
Archived topic from Anythingforums, old topic ID:495, old post ID:4399
command line compression?
Posted: Tue Jul 13, 2004 2:35 pm
by megaspaz
the command structure matters when using tar.
tar -cvzf name_of_archive.tar.gz directory_or_files
because the z came in front of the f, you need to put the name of the tarball first before the source directory. it could also be an error in the naming convention in that you gave the -z option so it was expecting the output file to have a *.tar.gz extension.
Archived topic from Anythingforums, old topic ID:495, old post ID:4400
command line compression?
Posted: Tue Jul 13, 2004 4:08 pm
by Red Squirrel
Thanks that worked... but I only got it down to 54MB and the folder was 64MB is that normal?
Archived topic from Anythingforums, old topic ID:495, old post ID:4405
command line compression?
Posted: Tue Jul 13, 2004 4:13 pm
by megaspaz
depends. i think gzip does really good on text files. if you got a lot of binaries, the compression might not be so good. if you want you can seperate out the commands. like do a tar first with no -z option and then use the gzip command.
man gzip
to get the options of gzip.
or you could try it with the -j option and try the bzip compression. iiirc, bzip should do better compression.
man bzip2
Archived topic from Anythingforums, old topic ID:495, old post ID:4406
command line compression?
Posted: Tue Jul 13, 2004 4:15 pm
by Red Squirrel
It's mostly text file (html and php) there's some binaries such as pictures but most of it is html. I'll try it with other folders though and see what I get. If not I can just set my samba permissions to write and do it with power archiver. gzip is way faster then black hole at compressing though. If I want to black hole my whole backup folder It's something I'd leave on overnight.
Archived topic from Anythingforums, old topic ID:495, old post ID:4407
command line compression?
Posted: Tue Jul 13, 2004 11:06 pm
by wldkos
Tar just makes an archive of the files with no compression. You need to add the -z for gzip compression which is really good. If you use -j in stead of -z you are using the bzip which is even better compression.
I think geekhaven had an article on this.
Archived topic from Anythingforums, old topic ID:495, old post ID:4464
command line compression?
Posted: Tue Jul 13, 2004 11:22 pm
by Red Squirrel
Yeah while gzip and tar are good, they don't compete with black hole.
But it's ok, since it's good to know there's the tar command since I can use this to make quick archives. I have a 30GB folder on my server and I ain't black holing that over the network.
So I'll gzip that one, much faster.
Archived topic from Anythingforums, old topic ID:495, old post ID:4465
command line compression?
Posted: Tue Jul 13, 2004 11:25 pm
by Red Squirrel
Hmm I just noticed I have backups of backups of backups at some places. while compression is good, nothing beats deletation, when you want to save space.
Archived topic from Anythingforums, old topic ID:495, old post ID:4466
command line compression?
Posted: Wed Jul 14, 2004 1:17 am
by Red Squirrel
hahaha I have an archive going and it's been like 2 hours.
It's a huge folder with tons of files of different type and sizes.
Archived topic from Anythingforums, old topic ID:495, old post ID:4469