Solved

rm huge backup file freezes web server

Posted on 2014-12-10
4
229 Views
Last Modified: 2014-12-15
Hi experts,

I found a problem on an Ubuntu-server (ext3) when deleting huge backup-files (50GB).
While deleting with "rm -r" I  the webserver apache will freeze for 1 minute.
I think it is because if the I/O load.

On a forum I found that using "ionice" would help.
So I could try using following:

ionice -c2 -n7 rm -r /path/to/the/backup_file

Open in new window


Do you think it is fine to use this?
Do you have an idea how long the deletion process would take? Without ionice it takes abot 4 minutes to delete a file with 50GB.

The goal is deleting the huge file while the server is running and the website should not be influenced.
0
Comment
Question by:Systemadministration
  • 2
4 Comments
 
LVL 7

Expert Comment

by:Thomas Wheeler
ID: 40493208
Sounds like your need to figure out whats going on with your disk. What type of setup is this? Is it one drive, a raid or an iscsi mount? Deleting this file should not cause this result. Are there errors in the logs?
0
 

Author Comment

by:Systemadministration
ID: 40493212
This seems to be a known problem:
http://serverfault.com/questions/480526/deleting-very-large-file-without-webserver-freezing

My question is only about ionice.
0
 
LVL 13

Accepted Solution

by:
Phil Phillips earned 500 total points
ID: 40493222
A better strategy might be to either store the backups on another server, or on another disk array.  That way, if you have to do disk-intensive operations, it won't affect the files that apache is trying to access.

That said, ionice should be fine as a work-around.  Another option would be to try truncating the file (which could be faster than the rm command):

> /path/to/the/backup_file

Open in new window


If you *really* want to get a feel for how long it will take, I recommend (if possible) testing it out first on a similar (but non-production) instance.
0
 

Author Closing Comment

by:Systemadministration
ID: 40500010
Great!
Truncation the 56GB file only took a few seconds. After that tha space was free again and I could delete the truncated file without risk.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reset Root Password on CentOS 6 4 69
installing LSI MegaRAID Storage Manager on CentOS 7 22 741
AWS ELB 5 95
When trying to install php-fpm on CentOS 7 - GPG error 2 43
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question