LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-06-2005, 06:54 AM   #1
katsal
LQ Newbie
 
Registered: Aug 2003
Location: Australia
Distribution: Red Hat Linux
Posts: 7

Rep: Reputation: 0
rm or rmdir will not work due to too many files


Hi People

I have encountered a very interesting issue today.
One of our systems is running low on inodes, but still have approximately 14,000 + available.
Now I require to remove approximately 200,000 + log files that exist under a directory in the /var file system. And yes it is over two hundred thousands files.

When attempting to run the standard rm * within the directory with all the files the command fails to delete any and returns the following error after a sometime.

ksh: /usr/bin/rm: arg list too long

Even when attempting to run rmdir -r and rm -r to remove entire directory structures and files that house all these files the same error occurs.

I never knew the rm command had limitations on how many files it could handle. This is a huge issue in my honest opinion and a quick cleanup is not at all possible. Has anyone ever encountered such an issue, and do other commands exist that will deal with such a volume of deletions.

Any advise and assistance would be appreciated.
Thanks in advance.
Alex
 
Old 05-06-2005, 07:17 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

indeed. there are limitations. this can happen with "ls" as well. kernel issue.
a trick to delete all your files in one directory...
Code:
#!/bin/sh
for i in `ls`
do
 rm -rf $i
done
now the argument is only one file. but this can take some time....

regards

slackie1000
 
Old 05-06-2005, 07:18 AM   #3
katsal
LQ Newbie
 
Registered: Aug 2003
Location: Australia
Distribution: Red Hat Linux
Posts: 7

Original Poster
Rep: Reputation: 0
Semi worked it out

Hi People.

Ive found a work around that appears to work fine.
I have used find . -type f -exec rm {} \; and this appears to be working fine without any errors.
Lucky I don't require any data at all within the subfolders that exist on this file system directory.
But if someone has an explaination to my inital post would be appreciated.
 
Old 05-06-2005, 07:25 AM   #4
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

take a look here and follow the link.
like i wrote, this is a kernelxmemory issue.

regards
slackie1000
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rmdir namit Linux - Software 2 10-23-2005 03:26 PM
apt don't work due to nvidia Mathsniper Debian 8 04-15-2005 08:15 AM
Error USB-HUC on booting due in mdk10 due to mx700 Boudewijn Mandriva 4 10-09-2004 09:36 AM
help: cdrecord does not work due to "Cannot open SCSI driver" parv Linux - Software 2 09-21-2004 09:54 PM
k3b adding mp3 "Unable to handle the following files due to an unsupported format:" true_atlantis Linux - Software 3 01-31-2004 06:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration