Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

2 Answers 2

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
    
Thanks for the answer that helps a lot. I'm using mdadm but I can't find the mdadm.conf anywhere on the system (find doesn't find the file), it's not under /etc/mdadm/ as guides suggest. The array disappears after reboot I think due to he config file problem. I tried creating it under /etc/mdadm but doesn't seem to work. –  JMC Sep 29 '11 at 19:53
1  
That would be a different question. If this one is answered correctly, you should accept it and post a new one for your mdadm problem. –  Warren Young Sep 29 '11 at 21:13
rsync -aHS /var/www/old-html/ /var/www/html/

Will copy all files 1:1 and all permissions.

share|improve this answer

Your Answer

 
discard

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.