Two partitions getting full

Posted on 2009-02-10
Last Modified: 2013-12-06
I have a web/db server with 4 drives on raid10.

The /usr and /var partitions are getting full.

Should I move /var and /usr to /home and symlink back to them or is that not recommended.

What do you recommend based on best practices.

Filesystem          1K-blocks             Used             Available    Use%     Mounted on

/dev/sda5            8123168          644292            7059584        9%     /
/dev/sda8        247004276      13293172        220961520        6%     /home
/dev/sda6            1019208          420536              546064      44%     /tmp
/dev/sda3            8123200        6292376            1411528      82%     /usr
/dev/sda2          10154020        6997620            2632280      73%     /var
/dev/sda1              124427            22440                95563      20%     /boot
tmpfs                   2021744                    0            2021744        0%     /dev/shm

Operating System: CentOS 5 (64-bit)
Processor: 4 x Quad Core - Intel Xeon E5335
Hard drive: 4 x 15K rpm SAS 147 GB
Question by:ray-solomon
    LVL 48

    Accepted Solution

    /usr should be an almost static filesystem, so not much need for worry there.

    /var is generally your most active filesystem as that's where all the logs/mail etc are written to.

    Ideally, you should resize your /home and /var filesystems, but if you don't want to go through that process, you could move some of the stuff out of /var into /home and create a symlink.

    LVL 10

    Author Comment

    Would you please see my commands below and make sure I did not miss anything?

    I am first going to do this on my testing server of course.

    cp /var /home

    cp /usr /home

    mv /var /var/old_var

    mv /usr /usr/old_usr

    cd /var

    ln -s  /home/var /var

    cd /usr

    ln -s  /home/usr /usr

    And then when I think everything is working fine, I could delete (rm -rf) /var/old_var and /usr/old_usr
    LVL 10

    Author Comment

    I modified it, and think this is a better way

    cp -r /var /home
    cp -r /usr /home

    mkdir /var/old_var
    mkdir /usr/old_usr

    mv /var/* /var/old_var
    mv /usr/* /usr/old_usr

    cd /var
    ln -s  /home/var /var

    cd /usr
    ln -s  /home/usr /usr
    LVL 48

    Expert Comment

    I really wouldn't recommend playing around with /usr as you get into trouble when you start trying to move things around.

    As for /var, you should ideally move things in single user mode to reduce the number of processes writing to files.

    What I would recommend is moving your largest directory under /var (eg: /var/log) to /home and do

    mkdir /home/var
    mv /var/log /home/var
    ln -s /home/var/log /var/log
    /etc/init.d/syslog restart
    /etc/init.d/cron restart
    /etc/init.d/xinetd restart


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now