- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Removing a directory with large number of files
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
08-06-2009 06:35 AM
08-06-2009 06:35 AM
Removing a directory with large number of files
"rm -rf dirname" is currently removing about 27,000 files/hr. At this rate it will take several days to finish.
Can anyone suggest a faster way, or a method of deleting a non-empty directory?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009 07:01 AM
08-06-2009 07:01 AM
Re: Removing a directory with large number of files
If the existence of the directory is blocking you from doing other operations, you might wish to rename the directory before deletion, so that it does not interfere with your other activities: renaming a directory is just a single operation, so it should always be fast. Then you can leave the directory removal operation running in the background with nohup and nice, so it won't block you from logging out nor spend any CPU power that would have more important uses.
nice nohup rm -rf /some/where/hugedirectory &
mK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009 07:01 AM
08-06-2009 07:01 AM
Re: Removing a directory with large number of files
The recursive remove you are using is probably about as fast as it is going to get.
If you only need a small fraction of the files within the filesystem, it might be faster to copy those somewhere; 'newfs' the filesystem; and restore the files you intend to keep.
Very large, very flat filesystems like you have lead to very long times for file removal.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009 07:08 AM
08-06-2009 07:08 AM
Re: Removing a directory with large number of files
It is going to take several days to finish.
That is what you get for putting 2 million files in a vxfs file system.
ls -1 > list
while read -r fn
do
rm -f $fn
done < list
That might be faster.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009 07:17 AM
08-06-2009 07:17 AM
Re: Removing a directory with large number of files
Better to recreate file system(newfs) after copying or backup required files.
Regards,
LIJEESH N G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009 08:31 AM
08-06-2009 08:31 AM
Re: Removing a directory with large number of files
I've already scolded the application team that created this mess and they have fixed their process.
Thanks to all!