Operating System - HP-UX
1752361 Members
6231 Online
108787 Solutions
New Discussion

Re: How to delete zero(0) size files in /var/spool/mqueue

 
NDO
Super Advisor

How to delete zero(0) size files in /var/spool/mqueue

Hi

 

I have lots of files in /var/spool/mqueue, as shown below:

 

mcelbill[220]/var/spool/mqueue #ls | wc -l
865
mcelbill[221]/var/spool/mqueue #du -sk
148504  .
mcelbill[222]/var/spool/mqueue #ls -lrt | head
total 294384
-rw-------   1 root       mail             0 Apr 15  2009 tfn3F6U3919153
-rw-------   1 root       mail             0 Jul  8  2009 tfn682Wia06264
-rw-------   1 root       mail             0 Jul  8  2009 tfn682Y5206306
-rw-------   1 root       mail             0 Jul 22  2009 tfn6LNax510371
-rw-------   1 root       mail             0 Jul 25  2009 tfn6P1FxT10200
-rw-------   1 root       mail             0 Jul 26  2009 tfn6PNM5D19566
-rw-------   1 root       mail             0 Jul 27  2009 tfn6QNdc307102
-rw-------   1 root       mail             0 Jul 28  2009 tfn6S5Y4h11652
-rw-------   1 root       mail             0 Jul 29  2009 tfn6T0qLX07277
mcelbill[223]/var/spool/mqueue #ls -lrt tail
tail not found
mcelbill[224]/var/spool/mqueue #ls -lrt | tail
-rw-------   1 root       mail             0 Jul  9 06:00 tfs690U0I20639
-rw-------   1 root       mail             0 Jul 10 08:00 tfs6A601H25997
-rw-------   1 root       mail             0 Jul 10 08:00 dfs6A601H25997
-rw-------   1 root       mail             0 Jul 10 08:00 xfs6A601H25997
-rw-------   1 root       mail             0 Jul 10 16:00 xfs6AE00o14492
-rw-------   1 root       mail             0 Jul 10 16:00 dfs6AE00o14492
-rw-------   1 root       mail             0 Jul 10 16:00 tfs6AE00o14492
-rw-------   1 root       mail             0 Jul 13 08:00 dfs6D600E28763
-rw-------   1 root       mail             0 Jul 13 08:00 tfs6D600E28763
-rw-------   1 root       mail             0 Jul 13 08:00 xfs6D600E28763
mcelbill[225]/var/spool/mqueue #

 They are filling up /var, as its now at 100%

 

I was thing in using "rm", but  I am not sure that is the right option

 

 

P.S. This thread has been moved from HP-UX > System Administration to HP-UX > messaging. - Hp Forum Moderator

7 REPLIES 7
Steven Schweda
Honored Contributor

Re: How to delete zero(0) size files in /var/spool/mqueue

 
NDO
Super Advisor

Re: How to delete zero(0) size files in /var/spool/mqueue

Hi

 

I have managed to reduced it up to 83%, but I beleive if I clean /var/spool/mqueue, it will decrease a bit further.

#bdf /var
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol10   4718592 3929696  788896   83% /var
mcelbill[356]/var #du -sk *
32      X11
1270384 adm
376     dt
0       empty
0       home
22368   jail
0       lost+found
8       mail
61376   microcode
8       net-snmp
0       news
1775720 opt
415600  preserve
24      run
1168    sam
289504  spool
16      statmon
48872   stm
4328    tmp
8       tombstones
0       uucp
1760    vx
96      yp
mcelbill[357]/var #uname -a
HP-UX mcelbill B.11.23 U ia64 2945220947 unlimited-user license

 

"/var/adm" is also big, but "sw" directory has data that I cannot remove, the same applies for "/var/opt"

 

 

Dennis Handly
Acclaimed Contributor

Re: How to delete zero(0) size files in /var/spool/mqueue

>I was thinking in using "rm", but  I am not sure that is the right option.

 

Well, other than the fact that you need to remove all of the tuples, it's fine.

 

I had a previous post on removing mass quantities and lo and behold, you had the same question before!

http://h30499.www3.hp.com/t5/Messaging/Help-in-clearing-out-var-spool-mqueue/m-p/5276103#M5446

Bill Hassell
Honored Contributor

Re: How to delete zero(0) size files in /var/spool/mqueue

Here's a better way to look at filesystem space:

 

# du -kx /var | sort -rn | head -20

4267800 /var 1997600 /var/tmp 1701992 /var/adm 1654320 /var/adm/sw 1249528 /var/adm/sw/save 729704 /var/tmp/labsystems 489072 /var/tmp/blh 395448 /var/tmp/labsystems/Dallas 384344 /var/adm/sw/save/PHCO_41439 354376 /var/opt 341896 /var/adm/sw/save/PHCO_41439/VXVM-RUN 301136 /var/tmp/labsystems/Dallas/OAT 270488 /var/tmp/blh/Git-1123 220232 /var/tmp/labsystems/Atlanta 218576 /var/tmp/blh/git-11.23 179120 /var/adm/sw/products 171088 /var/adm/sw/save/PHCO_41439/VXVM-RUN/etc/vx 171088 /var/adm/sw/save/PHCO_41439/VXVM-RUN/etc 168944 /var/stm 154800 /var/stm/logs

 

In this format, the largest directories and subdirectories are sorted to the top. In this example,  /var/adm/crash has an old crash dump that can be removed, about 490 MB. /var/tmp/gcc has already been installed, so that directory can also be removed returning 331 MB of space.

 

/var/tmp doesn't show any large subdirectories, so there must be a lot of files that can be removed.
To sort the files inside a directory, use:

 

# ll /var/tmp | sort -rnk5 | head -20

-rw-r--r--   1 root       sys        200000000 Feb 21 14:32 big200
-rw-r--r--   1 root       sys        100000000 Nov 13  2013 big100
-rw-------   1 root       sys        45086720 Jan 25  2013 HP-UX_11i_v2_Event...
-rw-------   1 root       sys        33679360 May  6 11:40 ixGnuPG_ixGnuPG_...
-rw-------   1 root       sys        16527360 Apr 16 15:59 openssl.depot
-rw-r--r--   1 root       sys        13407209 Apr 25 12:25 ctmAAAa15402
-rw-r--r--   1 root       sys        4191370 Apr 25 12:11 ctmAAAa15033
-rw-r--r--   1 root       sys         389120 Jul  2 11:22 11.11-Iether.tar
-rw-r--r--   1 root       sys         350459 Feb 10 06:05 atl1-crashcollector.tgz
-rw-r--r--   1 root       sys          57450 Mar 17 10:20 imgr.tusc
drwxrwxrwt  37 root       root         49152 Jul 14 08:41 .
-rw-------   1 root       sys          30720 Oct 30  2012 dplookresult.tar
-rw-r--r--   1 root       sys          16111 Jul 10 14:54 swagent.log
drwxr-xr-x  10 root       sys           8192 May 30 09:27 labsystems
drwxr-xr-x   5 root       sys           8192 May 21 07:52 tztab
drwxr-xr-x   4 pwallek    sys           8192 Dec 16  2013 pw
drwxr-xr-x   3 root       sys           8192 Oct 24  2013 bootdata
drwxr-xr-x   2 root       sys           8192 Dec 23  2013 drupalBuild
drwxr-xr-x   2 pwallek    sys           8192 Sep 19  2012 pw1
drwx------   4 root       sys           8192 Oct 14  2013 blh

So there are two very large test files that I forgot to remove, big200 and big100. And also several depots that have already been installed, so these can be removed.

 

In your example, /var/opt needs to be expanded to see the largest subdirectories, something like this:

# du -kx /var/opt | sort -rn | head -20

 

Also, read the man page for 'cleanup' and use it to properly trim the old, superceded patches in /var/tmp/sw.

 

And so on...

 

The zero length files occupy directory entries but no space so unless there were thousands of them, that isn't where the file removal needs to take place.

 

 



Bill Hassell, sysadmin
NDO
Super Advisor

Re: How to delete zero(0) size files in /var/spool/mqueue

 

 

I did use a script that you provided, sometime back:

 

#!/bin/sh
mailq | awk 'substr($0,1,1) !~ "[\t -]" { print $1 }' | while read i; do
rm /var/spool/mqueue/?f$i
done

 but this only works for non-zero length size files

NDO
Super Advisor

Re: How to delete zero(0) size files in /var/spool/mqueue

Hi

 

using "du" in /var/opt, resulted in:

du -kx /var/opt | sort -rn | head -20
1775720 /var/opt
914032  /var/opt/OV
909768  /var/opt/OV/tmp
520248  /var/opt/omni
520168  /var/opt/omni/log
127712  /var/opt/ignite
127216  /var/opt/ignite/recovery
127168  /var/opt/ignite/recovery/2010-11-23,11:13
91936   /var/opt/perf
91288   /var/opt/perf/datafiles
63928   /var/opt/sfmdb/pgsql
63928   /var/opt/sfmdb
44376   /var/opt/wbem
32768   /var/opt/sfmdb/pgsql/pg_xlog
30168   /var/opt/wbem/repository
28944   /var/opt/sfmdb/pgsql/base
19664   /var/opt/wbem/repository/root#cimv2
19104   /var/opt/wbem/repository/root#cimv2/classes
13520   /var/opt/sfmdb/pgsql/base/17142
9632    /var/opt/dce

 I beleive nothing much I can do here, but, using the "cleanup" command:

 

cleanup -p -c 1
### Cleanup program started at 07/14/14  16:26:35
Preview mode enabled. No modifications will be made.
Commit patches superseded at least 1 time(s) on 'mcelbill'.
Obtaining superseded patch information...done.

The following patches superseded at least 1 time(s) can be committed:

Superseded  # Times Superseded  Disk Space in /var/adm/sw/save  Superseded By
==========  ==================  ==============================  =============
PHCO_31601           1                   745472 bytes             PHCO_32426
PHKL_33494           1                   401408 bytes             PHKL_33820
PHKL_33495           1                    81920 bytes             PHKL_33562
PHKL_33552           1                   352256 bytes             PHKL_33563
PHKL_33607           1                   106496 bytes             PHKL_33731

All information has been logged to /var/adm/cleanup.log.
### Cleanup program completed at 07/14/14  16:26:35

 So , can I go ahead in clean these patchs

Bill Hassell
Honored Contributor

Re: How to delete zero(0) size files in /var/spool/mqueue

These are prime candidates since they are the largest directories that look like logs and/or temporary files.

 

909768  /var/opt/OV/tmp
520168  /var/opt/omni/log

 

For the /var/opt/OV/tmp directory, are you running Network Node Manager (NNM)? If so, have yout network admin cleanup the log files - there's 900 MB of files that need to be cleaned up.

For /var/opt/omni/log, your Data Protector admin needs to reduce the logs.

In both cases, you'll probably find very old files there that should have been removed.

/var ALWAYS needs regular maintenance as it will always grow larger.



Bill Hassell, sysadmin