LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   HELP! Diskspace :( (https://www.linuxquestions.org/questions/linux-newbie-8/help-diskspace-875131/)

TheOnlyQ 04-15-2011 04:40 AM

HELP! Diskspace :(
 
I have recently being struggling with an diskspace problem.

I run a i7 server in France and it is used as a production server (shared hosting)

Problem is that most space was allocated to /home/ of course for webhosting and only 10GB was allocated to /

Now the problem is that cPanel is freaking out because to put it basically, / is full.

/dev/root /var/named/chroot/var/run/dbus 95.11% (9661348 of 10157944)

I have 5TB on this thing but stupid me forgot to give / a little extra and I went along with the standard partition which only allocated 10GB.

I am wondering what I should do? I already moved the entire mysql database directory to /home/ and then did a symlink to save space, but that cleared 700mb and took it to 85%, WITHIN ONE DAY it went back up to 95% - there has to be something generating files and using all this space, if its logs then where should I look?

Sorry for all the questions, hope I can get an answer from one of you pro's - thanks.

EricTRA 04-15-2011 04:47 AM

Hello and Welcome to LinuxQuestions,

You could run this:
Code:

du -h / | grep ^[0-9.]*G
To find the directories that occupy the most diskspace and take it from there. Logs are normally found in /var/log so you could check which log (if any) is growing that rapidly. In that directory you should also have compressed older log files if your logrotate is setup correctly. If its logfiles that are consuming space then I'd look into which and why it/they are growing this fast and solve the problem. Next setup a decent logrotate plan limiting by size and deleting old logs after a short time or (even better if you need to keep them) move them using logrotate to another destination where you have space available.

Kind regards,

Eric

TheOnlyQ 04-15-2011 04:49 AM

Quote:

Originally Posted by EricTRA (Post 4325286)
Hello and Welcome to LinuxQuestions,

You could run this:
Code:

du -h / | grep ^[0-9.]*G
To find the directories that occupy the most diskspace and take it from there. Logs are normally found in /var/log so you could check which log (if any) is growing that rapidly. In that directory you should also have compressed older log files if your logrotate is setup correctly. If its logfiles that are consuming space then I'd look into which and why it/they are growing this fast and solve the problem. Next setup a decent logrotate plan limiting by size and deleting old logs after a short time or (even better if you need to keep them) move them using logrotate to another destination where you have space available.

Kind regards,

Eric

Thanks for the fast reply - Would it be possible for me to delete ALL log files in /var/log/ without any issues?

EricTRA 04-15-2011 04:53 AM

Hi,

Most likely you'll encounter problems if you do so. All logs with an extension gz.X (X is a number) or just X (number) can be deleted without any problem since they are 'older' logs. The ones that have the normal .log extension I wouldn't delete. If one of them (or more) are big in size check why (look at the content), note the errors and solve them. If you need to reduce them you can do:
Code:

echo >/var/log/logfilename
Some processes freak out when you just delete the logfile if not setup correctly.

Kind regards,

Eric

TheOnlyQ 04-15-2011 04:59 AM

Quote:

Originally Posted by EricTRA (Post 4325294)
Hi,

Most likely you'll encounter problems if you do so. All logs with an extension gz.X (X is a number) or just X (number) can be deleted without any problem since they are 'older' logs. The ones that have the normal .log extension I wouldn't delete. If one of them (or more) are big in size check why (look at the content), note the errors and solve them. If you need to reduce them you can do:
Code:

echo >/var/log/logfilename
Some processes freak out when you just delete the logfile if not setup correctly.

Kind regards,

Eric

Understood - I just cleaned out a 1GB file named exim_mainlog which I understand is the mail-log file.

It instantly rose back to 1mb within a minute or so, thats pretty fast - is there anyway I can find out why this is growing so fastly?

Would it be safe to put /var/log/ in /home/log/ and then symlink /var/log/ to /home/log/ ?

repo 04-15-2011 05:01 AM

Deleting log files will just solve your problem for now.
You could create a script to delete the rotated log files, and put it in a cronjob.
If you have physical access to the server, an other option is to backup the
/home partition, and use gparted to shrink it.
Then you can create a separate partition for /var

Kind regards

TheOnlyQ 04-15-2011 05:07 AM

Quote:

Originally Posted by repo (Post 4325302)
Deleting log files will just solve your problem for now.
You could create a script to delete the rotated log files, and put it in a cronjob.
If you have physical access to the server, an other option is to backup the
/home partition, and use gparted to shrink it.
Then you can create a separate partition for /var

Kind regards

I would love to do that but do not have physical access.

repo 04-15-2011 05:11 AM

Quote:

It instantly rose back to 1mb within a minute or so, thats pretty fast - is there anyway I can find out why this is growing so fastly?
A good start would be to look at the logs.
Do you have allot of mail traffic?
You can however set the log level lower
http://www.exim.org/exim-html-3.20/d...51.html#SEC862

Kind regards

repo 04-15-2011 05:16 AM

Quote:

Would it be safe to put /var/log/ in /home/log/ and then symlink /var/log/ to /home/log/ ?
Yes, but you need to reboot, in order to make it work.
Take a look at
http://serverfault.com/questions/559...-log-directory

Kind regards

EricTRA 04-15-2011 05:36 AM

Quote:

Originally Posted by repo (Post 4325302)
Deleting log files will just solve your problem for now.
You could create a script to delete the rotated log files, and put it in a cronjob.
If you have physical access to the server, an other option is to backup the
/home partition, and use gparted to shrink it.
Then you can create a separate partition for /var

Kind regards

Hi,

No need to write a separate script for that. You can easily configure all you need in a logrotate config file. Have a look at the man page for logrotate:
Code:

man logrotate
more in particular the parameters rotate, size and olddir.

Kind regards,

Eric

EricTRA 04-15-2011 05:37 AM

Quote:

Originally Posted by TheOnlyQ (Post 4325301)
Understood - I just cleaned out a 1GB file named exim_mainlog which I understand is the mail-log file.

It instantly rose back to 1mb within a minute or so, thats pretty fast - is there anyway I can find out why this is growing so fastly?

Would it be safe to put /var/log/ in /home/log/ and then symlink /var/log/ to /home/log/ ?

Hello,

If that log file is growing that fast, then better have a look inside (cat, less, more) and post some lines here to see if we can pinpoint what's going on.

Kind regards,

Eric


All times are GMT -5. The time now is 03:34 AM.