LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-05-2019, 04:10 AM   #1
ajidi
LQ Newbie
 
Registered: Jul 2019
Posts: 3

Rep: Reputation: Disabled
Angry gzip log file


hi, im having a disk space issue due to the log. Then run gzip to the log file and move it to other directory. after move the file. the space still show the same 100% when run df -h. and also the new log file is not recreate after run the gzip. how to recreate the log file? any help is appreciated. tq
 
Old 07-05-2019, 06:13 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,287

Rep: Reputation: 859Reputation: 859Reputation: 859Reputation: 859Reputation: 859Reputation: 859Reputation: 859
To uncompress a file, use gunzip.

Are you sure that
1- compression succeeded? If the filesystem is full, there is a chance it fails
2- the compressed file is significantly smaller than the original file?
3- the log file's size is large enough to make a difference?
4- you moved the compressed file to a different filesystem?
 
Old 07-05-2019, 10:56 AM   #3
ajidi
LQ Newbie
 
Registered: Jul 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
hi berndbausch. Thanks for your help and reply

To uncompress a file, use gunzip.
Yes, manage to gunzip the zip file at a different location but plan not to move it back to the same old path due to disk is full. log size almost 10gb.
the plan is after move the log file, the system will generate new log but seems it never happen.

Are you sure that
1- compression succeeded? i run the gzip command show nothing success or fail message. it just go back to the normal prompt servername[root] / #
If the filesystem is full, there is a chance it fails- cant tell success or fail but if fail any chance to rollback?

2- the compressed file is significantly smaller than the original file? yes.after gunzip. run tail command looks same as before compression.

3- the log file's size is large enough to make a difference? yes

4- you moved the compressed file to a different filesystem? yes different mount point
 
Old 07-05-2019, 11:21 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,933

Rep: Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857
What distribution/version are you running and what process is creating the log file?

If the file is still open (in use by a running process) when moved it will still be accessible to this process and will continue to occupy space on disk. Restarting the process should clear the filesystem as well as create a new log file. I assume the log file is not being managed by logrotate which will limit its size.
 
Old 07-05-2019, 11:40 AM   #5
ajidi
LQ Newbie
 
Registered: Jul 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
hi Michaelk,

Linux version 2.6.32-431.17.1.el6.x86_64. Red Hat 4.4.7-4.

The thing u mention makes sense. must be the file is still open by the process. not sure about logrotate. First time i heard of. anyway, The log file belong to FluentD program. not sure how to restart the program but surely will google later.

thanks a lot for your prompt reply
 
Old 07-05-2019, 08:30 PM   #6
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: CentOS, MacOS, [Open]SuSE, Raspian, Red Hat, Slackware, Solaris, Tru64
Posts: 1,478

Rep: Reputation: 154Reputation: 154
Quote:
Originally Posted by ajidi View Post
hi, im having a disk space issue due to the log. Then run gzip to the log file and move it to other directory. after move the file. the space still show the same 100% when run df -h. and also the new log file is not recreate after run the gzip. how to recreate the log file? any help is appreciated. tq
Does the filesystem show 100% as a "normal" user? or is it 100% when logged in as root? Typically, root has access to some additional disk space that regular users cannot use. One big reason for this is so these "disk full" situations can be dealt with. When the log file is being compressed, there needs to be sufficient disk space to hold both the uncompressed file as well as the compressed file. Hopefully, that additional space available to root will be enough. You can see how many blocks are reserved for root using
Code:
tune2fs -l /dev/sdXN | grep -i 'reserved block count'
Block sizes are either 512 bytes or 4096 bytes so do that math to figure how many reserved bytes are avalable.

You can see how big a gzipped file will end up being w/o actually creating the disk file using the command:
Code:
gzip -c log-file-name | wc -c
Try it out on some of the logs until you find one that, when compressed, doesn't exceed that reserved space.

To make sure you free up as much space as possible, use the "-9" option for maximum compression. It's a tad slower but you need disk space so the minor wait shouldn't matter.

If, on the other hand, you see 100% when logged in as root, you'll need eliminate/sacrifice a file or, preferably, move something off onto a thumb drive to free up enough space for gzip to be able to do its work.

Good luck...

Last edited by rnturn; 07-05-2019 at 08:35 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to open gzip file? I have gzip installed mhg Linux - Newbie 3 10-24-2008 02:18 AM
[gzip] appears in process table after gzip command completes redmanDBA Linux - General 0 02-26-2008 06:12 AM
apt-get update error: "gzip: stdin: not in gzip format" haertig Debian 0 08-02-2006 05:21 PM
When to use tar , gzip and tar+gzip ? tofee Linux - Newbie 4 03-31-2006 05:59 AM
Solaris 8 gzip issues- cannot gzip -d lynx sixosix Solaris / OpenSolaris 4 03-13-2005 03:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration