need to create space on CentOS - dev/md1 94% full

6,512

Solution 1

Two things spring to mind:
* Are your logfiles growing larger than you need them to be?
* Where are your databases stored?

Logs

Check the (many) log locations and see if there are any files that contain only data about time periods too far in the past for you to need to refer to them. If any such files are present, either just remove them or back them up elsewhere first just in case you do need to refer to them later. Make sure you don't delete log files that contain recent data - you may need them for problem diagnostics and they may be needed by part of cPanel for, for instance, bandwidth accounting and other resource tracking functions.

When I last administrated a cPanel server (which is some time ago, so things may be different now) it didn't see to purge many old logs. The per-account Apache logs were a particular culprit.

This is moot if your log files are not held on the partition that is nearly full, of course. See this graphic for a guide to places to look for log files in.

Databases

cPanel's default setup used to keep mySQL databases under /var/lib/mysql/ which could be a problem if this is still the case, you have large databases, and /var is part of your root filesystem instead of being in its own separately mounted filesystem.

If this is the case then you could move these data files elsewhere, such as a subdirectory of /home or where-ever you have enough space, either by moving them and reconfiguring mySQL to look at the new place, or moving then and making /var/lib/mysql/ a symlink to the new place (remember to stop mySQL before making changes). Using the symlink option may be safer than reconfiguring mySQL as there is less chance of a later cPanel update accidentally reverting your change.

The same goes for other database providers too, i.e. if you use postgres its data files may also be in an inconvenient place.

Solution 2

What else is part of the root file system? If /var is included, then filling up root would then affect log collection. One immediate thing I would try to clean up space is to remove any yum related downloads by doing:

# yum clean all

Solution 3

I assume by root partition you actually mean the root partition ("/") not "/root"...

cd / du -h --max-depth=1

that will show you the space used by the contents of every directory under /.

Start drilling down and finding things you can remove...

Share:
6,512

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I have a CentOS Linux dedicated server that is sending me warning messages everyday that it is short on space.

    The Servers is CentOS Release 5.4 final running cPanel/WHM with fantastico and RVSkins

    It has 700gb hard drive but came with a 20gb partition for root which is 94% full I keep looking through to find more to delete, but seem to be at a point now where I cant find anything else to delete :(

    Can anyone offer any advice as to what could be deleted that would not effect the running of the server. I could delete rvskins but it doesnt seem to take a lot space.

    The server is used to house several ecommerce websites, would they be some modules in cpanel i could delete that would give me a couple of gb?

    Any advice would be appreciated.

    Also what will happen if it gets to 100% full ?

  • Bill Weiss
    Bill Weiss about 14 years
    You mean cd /, I think. Or, your comment is wrong :)
  • Jason Antman
    Jason Antman about 14 years
    Oops. Yeah. Should try to keep the right thoughts in the right window... Corrected. Thanks.
  • Admin
    Admin about 14 years
    Filesystem Size Used Avail Use% Mounted on /dev/md1 20G 17G 1.6G 92% / /dev/md2 668G 160G 475G 26% /home /dev/shm 2.0G 0 2.0G 0% /dev/shm /usr/tmpDSK 485M 12M 448M 3% /tmp This avhieved 1GB thank you
  • Admin
    Admin about 14 years
    yes indeed mysql is in there and there is a load of mysql database i can delete for starters, but i would also like to move this also, but do not have the confidence/skill to do this (is this something you would do? if so what cost?)
  • Ariel Lindgren
    Ariel Lindgren about 14 years
    yes sorry i mean root partition. i have run that and it started with ./lost+found and has not moved for over 10 minutes? will update once it does. thank you
  • Ariel Lindgren
    Ariel Lindgren about 14 years
    there was too much to post into here as the formating would make it all look mumbo jumbo, but other than saying var was 2.4g there wasnt any others that looked that big, thanks Rob
  • Axel
    Axel about 14 years
    I could do it for you (as no doubt could many others) but it really is something you should be able to do as a server admin so I would recommend you at least try in a test environent (on a local VM for instance). The move-and-symlink procedure is very simple (make sure backups are OK just in case, stop services, move files/directories, make symlink, restart) IIRC cPanel still have free 30 day trail licenses that you can use to test the software, including procedures like this, before trying in a live environment.
  • Admin
    Admin about 14 years
    Hi David, im not a Server Admin, and I shouldnt be let loose on linux, I am a web designer that is self employed managing my own server with no real knowledge, last year ran chown on the whole server making everything in the complete server owned by an account, then to try and fix it changed everything to owned by root and as you can imagine everything ground to a halt, it took me around a week to recover all my clients sites and setup on a new server, was a nightmare, I now have only handful of commands i dare run and have them pre-written!
  • Axel
    Axel about 14 years
    @Rob: In that case I would recommend trying to find a server management company or move to a managed server - that way you have someone on-hand to deal with these things for you. Sites like www.webhostingtalk.com are a good place to look for relevant info/offers (make sure you try find reviews of companies to avoid bad apples). Think of the extra monthly cost as an insurance premium of sorts! Of course if you'd rather pay some random stranger to take your root password and do the work with no guarantee or SLA feel free to hunt out my email address...
  • Axel
    Axel about 14 years
    @Rob: Your honesty is refreshing BTW. There are many with less experience than you show who claim to be experts!