Operating System - HP-UX
1828371 Members
3057 Online
109976 Solutions
New Discussion

Identifying the files in different /var file systems

 
SOLVED
Go to solution
Shivkumar
Super Advisor

Identifying the files in different /var file systems

Dear Sirs,

We usually receive the alerts for full disk space from /var file systems.
We have 3 /var file system as shown below:-

/dev/vg00/lvol8 /var
/dev/vg01/syslogs /var/opt/logs
/dev/vg00/lvol9 /var/adm/crash

supposing the case of alerts received from all the above 3 file systems; I need to identify before deleting the files they
belong to which particular /var file system ?

Thanks,
Shiv
7 REPLIES 7
Rick Garland
Honored Contributor

Re: Identifying the files in different /var file systems

You could use find in just /var


# find /var -name "$FILE" -print

Since you are not using the -xdev option to find, it will cross over file system mount points.
Raj D.
Honored Contributor

Re: Identifying the files in different /var file systems

Hi Shiv,

Here it is :

You need to check /var/ filesystem for big files , and not /var/adm/crash and /var/opt/logs , as /var filesystem got alert.

Here how you can do that easily:

1.
# cd /var
# find . -type f -xdev -exec ls -l {} \; > /tmp/out.txt

[ out.txt will contain all the files from /var file systems. ]

2.
# cat tmp.out | sort +4 -5nr > /tmp/out1.txt

Check for the file out11.txt for largest files , and it will be in order from highest to lowest size.

Hope this will help ,

Enjoy,

hth,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
James R. Ferguson
Acclaimed Contributor
Solution

Re: Identifying the files in different /var file systems

Hi SHiv:

The alert message should point you to the correct filesystem, either by the mountpoint ('/var' versus '/var/opt/logs' versus '/var/adm/crash') or by the special device file on which the filesystem is mounted (e.g. '/dev/vg00/lvol9).

Of course, a 'bdf' will show you the utilization of each mountpoint and :

# du -k mountpoint | sort -k1nr | more

...will summarize the largest-to-smallest files and directories within a mountpoint.

Regards!

...JRF...
Raj D.
Honored Contributor

Re: Identifying the files in different /var file systems

Shiv,
little mistake in my last post ,
In 2nd step the command should be:

2.
# cat /tmp/out.txt | sort +4 -5nr > /tmp/out1.txt

hth,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Rodney Hills
Honored Contributor

Re: Identifying the files in different /var file systems

You could also run a "bdf" to see which file systems are at 100%.

HTH

-- Rod Hills
There be dragons...
Sandman!
Honored Contributor

Re: Identifying the files in different /var file systems

Shiv,

Use the du command with the "-x" switch which will show output only for the filesystems of interest. For example

# du -kx /var/opt/logs | sort -nr | more

...will display the biggest files that belong only to the /var/opt/logs mount point. Repeat the process for each of the others.

hope it helps!
Rick Garland
Honored Contributor

Re: Identifying the files in different /var file systems

In viewing the posts, I believe I misread the question.

Use the du command.

du /var -ka | sort -nr | more
This will report file names and sizes in ascending order by filesize.

Use the -x option with du to not cross the mount points