Error: No space left on device: mod_rewrite: Parent could not create RewriteLock file

Posted on

 Apache  service on a Server stops while restart it shows following messages in error_logs
[Thu Jun 20 20:04:20 2013] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock
Configuration Failed

Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.

Using the below command you can semaphores list.

root@server04 [~]# ipcs -s | grep nobody

So, In-order to clear the semaphores list. We have execute the following command.

root@server04 [~]# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem

After clearing the semaphores list, restart the apache server. Now, it will starts without any issues.But, it is an temporary solution it will re-occur when Semaphores get full.

Add following lines in “/etc/sysctl.conf” to get this issue fixed permanently. These values will increase the limits of Semaphores on the Server.

# Increases the semaphore limits & extend Apache’s uptime.

kernel.msgmni = 512
kernel.sem = 250 128000 32 512

Then load the new settings into the kernel using the command.

root@server04 [~]# sysctl -p
Now you are in safe zone.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s