Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ls "Not Enough Memory"

Status
Not open for further replies.

dial8d

Technical User
Feb 6, 2006
80
GB
Heres the story.

I have inherited an AIX 5.1 ML5 server, which has a filesystem which has a huge number of small files within it .

I want to create a list of the files, so i can see what they are, for deletion/archiving etc.

However, attempts to run ls against this filesystem are failing,

myserver:/directory# ls | wc -l
ls: 0653-340 There is not enough memory available now.
0

The server has 3gb physical, and 2gb paging space.

size inuse free pin virtual
memory 786415 753658 32757 185444 273898
pg space 524288 144963


I figured the problem is probably limits related, and have tried setting various different limits for rss but to no avail.

myserver:/# ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 131072
stack(kbytes) 32768
memory(kbytes) 32768
coredump(blocks) 2097151
nofiles(descriptors) 2000

section of /etc/security/limits

default:
fsize = 2097151
core = 2097151
cpu = -1
data = 262144
rss = 65536
stack = 65536
nofiles = 2000

root:
fsize = -1

Any ideas what else i can try ?
 
Add the line

rss = unlimited to the root stanza in /etc/security/limits

Mike

"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant."

 
Also what's the maintenance level?

oslevel -r



Mike

"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant."

 
It is local filesystem, but is NFS shared.

Just tried setting rss to unlimited by running

chsec -f /etc/security/limits -s root -a rss=-1

set successfully in limits

root:
fsize = -1
rss = -1

But problem remains ;

myserver:/mydirectory# ls | wc -l
ls: 0653-340 There is not enough memory available now.
0

The filesystem is locally mounted, but is NFS shared.
 
i stand corrected, its ML06

5100-06
 
Perhaps find has a way with dealing with this directory?

find /mydirectory | wc -l

Also, find out if your 'ls' is not an alias to e.g. 'ls -ltr', that would consume a lot of memory on a huge dir...

Type

alias|grep ls

to find out.


HTH,

p5wizard
 
Ah, i may have found a way to work round it.

Im using find with ls to redirect output into a file, which i should be able read.

find . -type f -exec ls -lrt {} \; > /files.txt

Seems to be ticking along ok.
 
If you are hoping to get a list of files, sorted by age, no can do with a

find . -exec ls -lrt {} \;

this will just do an ls -l for every file found under the current dir, in the order that "find" finds the files.



Oh, and the shortcut

find . -ls

would do about the same, but without invoking the ls command for every file found. (Roughly amounts to ls -filds filename)


HTH,

p5wizard
 
Hi p5

yes, 'find . -ls' seems much more efficient, and gives me all i need.

Thanks for your responses guys ! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top