Results 1 to 8 of 8

Thread: New question about cleaning /tmp and /var

  1. #1

    Default New question about cleaning /tmp and /var

    I have read in several sites that in opensuse it's possible to clean unused files that remain accumulated in /tmp and /var directories.
    I tried this today deleting manually all the content of these dirs as root.
    /var had more than 2 GB size and I know many things there were created by cache and remain there after that but are never used again. However after deleting all the cotent of this dir I damaged my system seriously.
    I just had no further problem because I had my partition cloned with clonezilla so all I needed was to restore it back again.
    But the question is:
    In the content of /var directory how can I know what is garbage left by caches and what are important config files so that I can make a responsible cleaning?

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,851

    Default Re: New question about cleaning /tmp and /var

    Better not clean /tmp (and /var/tmp) when the system is full in use. You can clean /tmp (and /var/tmp) at boot time because all that is in there is then leftovers from the last session.

    You can make your system doing this by going into YaST > System > /etc/sysconfig editor and then open +System +Cron. There you will find parameters like CLEAR_TMP_DIRS_AT_BOOTUP and friends. Read what they say and configure. Do not make it to complicated.

    The rest of /var (that is besides /var/tmp) is better NOT deleted without further thought. There are very importannt things there.
    But take a look at /var/log. If it contains old log files, you can delete them (except when you think you will do something with them in the future). Checking this once a year is usualy enough.
    Henk van Velden

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,345
    Blog Entries
    3

    Default Re: New question about cleaning /tmp and /var

    "/var/tmp" has temporary files.

    There is a lot that is not temporary elsewhere in "/var".

    If you are tight on disk space, then deleting files whose name ends ".bz2" in "/var/log" should be safe. They are a historical record of old log messages, but nothing running on the system requires them. I'm not sure that there is much elsewhere that could be deleted.

    You can configure the system to automatically empty "/tmp" on bootup (check the "/etc/sysconfig" settings in Yast).
    openSUSE Leap 15.1; KDE Plasma 5;

  4. #4
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: New question about cleaning /tmp and /var

    On 2011-05-29 20:36, fernando a martin wrote:
    > In the content of /var directory how can I know what is garbage left by
    > caches and what are important config files so that I can make a
    > responsible cleaning?


    You can not delete things in /var. Those that should have scripts dedicated
    to clean them periodically (/var/tmp, /var/log). Most others are meant as
    permanent. You can only delete somethings when you know what they are.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  5. #5
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,439

    Default Re: New question about cleaning /tmp and /var

    I use the settings suggested by hcw and I have 495Mb in /var having recently booted the computer.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,851

    Default Re: New question about cleaning /tmp and /var

    Quote Originally Posted by john_hudson View Post
    I use the settings suggested by hcw and I have 495Mb in /var having recently booted the computer.
    I have about half of it. But remember that there can be many things in /var. MySQL databases are in /var by default! And with a big database your /var can thus be GB of size (I would recommend to reorganise in that case of course, but just an example).
    Henk van Velden

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: New question about cleaning /tmp and /var

    On 2011-05-30 11:06, hcvv wrote:
    >
    > john_hudson;2346547 Wrote:
    >> I use the settings suggested by hcw and I have 495Mb in /var having
    >> recently booted the computer.


    > I have about half of it. But remember that there can be many things in
    > -/var.- MySQL databases are in -/var- by default! And with a big
    > database your- /var- can thus be GB of size (I would recommend to
    > reorganise in that case of course, but just an example).


    Faxes, mail store, rpm databases, rpm caches (for a whole network if
    configured!)

    I have 12 GiB there.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  8. #8

    Default Re: New question about cleaning /tmp and /var

    Thanks. Now i understood the point.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •