HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- lsof vs sar -v
Operating System - HP-UX
1836580
Members
1627
Online
110102
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 08:33 AM
11-20-2002 08:33 AM
lsof vs sar -v
on my hpux, i want to know witch files are opened.
when i do:
sar -v : i have 17000 opened files.
But when i use lsof:
lsof |wc -l : i have 10000 opened files....
And 10 000 != 17000 ...why ???
when i do:
sar -v : i have 17000 opened files.
But when i use lsof:
lsof |wc -l : i have 10000 opened files....
And 10 000 != 17000 ...why ???
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 08:55 AM
11-20-2002 08:55 AM
Re: lsof vs sar -v
sar -v 1 1 shows the size of the kernel table which is a cache table. This means its displaying the maximum size the cache table has grown to since last reboot - it is NOT the current number of open files in use at the time you run sar. If you run this command just after a reboot and compare to the lsof command below they should be much closer to each other.
lsof is more accurate to show the current number of open files - but it may show a single file open for many processes - artifically inflating the results, so you need to modify the lsof command to filter out duplicates;
lsof | awk '{print $9}' | sort -u | wc -l
This gives the current number of unique open files - which should always be lower than sar -v reports.
Im from Palmerston North, New Zealand, but somehow ended up in London...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 09:11 AM
11-20-2002 09:11 AM
Re: lsof vs sar -v
Hi "parent",
the kernel table contains one entry for every handle into a file, so if one process has a file open in two places, that takes two entries (or two processes having the same file open).
Take your shell as an example:
- one process
- one terminal (tty)
- three "handles" all using the same file (stdin/stdout/stderr all go to your tty)
HTH,
Wodisch
the kernel table contains one entry for every handle into a file, so if one process has a file open in two places, that takes two entries (or two processes having the same file open).
Take your shell as an example:
- one process
- one terminal (tty)
- three "handles" all using the same file (stdin/stdout/stderr all go to your tty)
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2002 03:44 AM
11-21-2002 03:44 AM
Re: lsof vs sar -v
Hi!
You have a system wide file table, sized by tunable nfile. The sar -v output gets the number of currently used slots of this file table... it uses pstat_getdynamic() to get the psd_activefiles metric. This has nothing to do with caching... the metric is accurate and actually indicates when "File table overflow" (ENFILE) would occure.
The lsof goes the other way round, starting from the processes file descriptors (not global) which may reference file table slots.
I never saw both reporting exaclty the same, but similar values using this:
# lsof +ff | cut -c 38-47 | sort -u | wc -l
... where +ff adds the FILE-ADDR to the output.
Best regards...
Dietmar.
You have a system wide file table, sized by tunable nfile. The sar -v output gets the number of currently used slots of this file table... it uses pstat_getdynamic() to get the psd_activefiles metric. This has nothing to do with caching... the metric is accurate and actually indicates when "File table overflow" (ENFILE) would occure.
The lsof goes the other way round, starting from the processes file descriptors (not global) which may reference file table slots.
I never saw both reporting exaclty the same, but similar values using this:
# lsof +ff | cut -c 38-47 | sort -u | wc -l
... where +ff adds the FILE-ADDR to the output.
Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP