- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Removig large directory
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
09-14-2008 12:10 AM
09-14-2008 12:10 AM
Removig large directory
OS HP-UX 11.11
I wanna remove one directory which is having application logs more than 400000 andsize 20GB+
I tried rm -rf command for remove logs directory but its taking to much time.
Please suggest me any solution which will took 2-3 Hrs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 12:50 AM
09-14-2008 12:50 AM
Re: Removig large directory
You should clear the logs inside this directory if you dont need that logs.
> log file name ( to trim the log file )
rm -rf directory ( to remove the directory )
Thanks
SKR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 12:52 AM
09-14-2008 12:52 AM
Re: Removig large directory
Thanks
SKR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 01:57 AM
09-14-2008 01:57 AM
Re: Removig large directory
We tried rm -rf directory command. But it is taking time in hours. But Is there any faster way? Is it possible to change any kernel parameter for quicker result?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 02:46 AM
09-14-2008 02:46 AM
Re: Removig large directory
Thanks
SKR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 04:44 AM
09-14-2008 04:44 AM
Re: Removig large directory
to rm a file a lot of things have to be done:
e.g.
maintaining file system journal, change filesystem blocklist, change directory entry, commit journal.
this has to be done for each file and for millions of files .... a lot of work.
Think of a cleaning job that runs more frequently.
Think about splitting the logfiles into different directories by application or date.
Also think about a dedicated filesystem. Then you can play with vxfs-mountoptions:
see mount_vxfs(1m).
Generally it is a bad idea having that much files in one directory. Every "ls -l" causes huge load. Think about all that poor programmed scripts with lots of "ls -l | awk ...". And if that directory is shared via nfs/cifs situation gets worse.
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 05:38 AM
09-14-2008 05:38 AM
Re: Removig large directory
and what about renaming the directory "away", recreate it for new logs and then slowly delete the old?
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 06:53 AM
09-14-2008 06:53 AM
Re: Removig large directory
I guess if the filesystem the directory is in is a VxFS filesystem you could try remounting it temporarily with the tmplog option to reduce the amount of metadata logging VxFS has to do. Something like this should work:
mount -F vxfs -o remount,tmplog /myfilesystem
Obviously substituting your filesystems name. Once complete you should be able to reinstate the original filesystem options by using:
mount -F vxfs -o remount /myfilesystem
This is all assuming your filesystem is in /etc/fstab. I also have no idea whether this will work on a system without OnlineJFS, and whether it will make any difference at all to the performance of the "rm -rf" command - you'll just have to give it a try...
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 07:16 AM
09-14-2008 07:16 AM
Re: Removig large directory
This is normal behavior that can be checked for progress with a find command.
find /filesystem | wc -l
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 09:06 AM
09-14-2008 09:06 AM
Re: Removig large directory
I suppose emptying each file (as SKR says) and then unlinking the directory wouldn't lose most of the space.
If there is nothing else in the filesystem, you could just recreate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2008 09:52 PM
09-14-2008 09:52 PM
Re: Removig large directory
If you want to delete the directory then first trim the logfiles with
> logfile (trim the log file)
once the files got trimed then apply the rm -Rf directory, it will remove your directory more faster then only doning rm -Rf
Suraj