Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to improve the performance of a web application running on Apache, so I created a Raid Array on /dev/md0.

Now I need to figure out how to move the application to the array and make sure that Apache will still serve it when someone accesses my domain.

Web application is in the directory: /var/www/html - Raid Array device is: /dev/md0

How do I make the application run on the array?

share|improve this question
up vote 5 down vote accepted

Try this:

# cd /var/www
# mv html old-html
# mkdir -m755 html
# mount /dev/md0 html
# cp -pr old-html/* html

That should mirror the current contents of /var/www/html onto the RAID array.

Some notes:

  1. The mount command might need tweaking, and ultimately you will want to have an entry in /etc/fstab for it. I assume whatever guide you're using to set up the RAID array has got the correct mount and fstab info.

  2. The permissions on /var/www/html are simply what I have here. You might need to adjust them to match your site's existing perms.

  3. The cp command won't copy dotfiles at the top level of your site. If for some strange reason you have a top-level .htaccess file, for example, instead of having the root site config in /etc/httpd somewhere, you'll have to copy that file over by hand. (I could have given you a more complex command that would copy top-level dotfiles, too, but there seems little point.)

share|improve this answer
rsync -aHS /var/www/old-html/ /var/www/html/

Will copy all files 1:1 and all permissions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.