I have 2 hard drives,, and i want the system to run on the first hard drive and var/www/ to run on the second , how do I accomplish this? Either through webmin or terminal, Is this something I can do?
Replies (2)
and I am trying to do this with lamp appliance
Reply 1Probably possible in Webmin but I think terminal easier...
Reply 2In essence what you need to do is set your system to mount the new HDD at /var/www. This is how I would do it.
Assuming that you have already installed LAMP to your first HDD then you'll want to first work out what your new HDD is. Run
fdisk -l
and see what shows up. Normally your existing HDD should be sda and your second should be sdb (so ensure that those 2 show up). To double check that your primary HDD is sda run
mount
It should should mention sda1 in amoungst some other entries and there should be no mention of sdb. Assuming that is the case mount your new HDD (temporarily) like this
mount /dev/sdb1 /mnt
Now stop Apache and copy across the current contents of /var/www, then rename the current www folder (as a backup), recreate www and create an index file in the existing www so you'll know straight away if something is wrong later down the track...
service apache2 stop cp -R /var/www/* /mnt mv -R /var/www /var/www-backup mkdir /var/www touch /var/www/index.htm echo "Error - the drive that contains /var/www on this server is unmounted" >> /var/www/index.htm
Now you can restart Apache to check that your error file works
service apache2 start
Now browse to http://<server-IP> and hopefully you should see the error message above ("Error - the drive that contains /var/www on this server is unmounted").
Assuming that is all good stop apache again
service apache2 stop
In this day and age you should probably do it via the UUID of the HDD - although personally I still use the standard identifiers (e.g. sdb1). You should be able to work out what your new HDD's UUID is with
blkid
Now you want to unmount the drive (from /mnt) and add a new enty to your fstab file
nano /etc/fstab
And add a new line using a format like this: UUID MountPoint FSType Options Dump Fsck
So it will look a little like this
UUID=MyUUID /var/www ext4 defaults 0 0
Obviously subsitute MyUUID for the real UUID (that you discovered with the blkid command)
Save and exit (OTTOMH <Ctrl><X> then <Enter>x2). Now test your new entry with
mount -a
And then run
mount
to check that your HDD is there. Assuming all is well then restart Apache
service apache2 start
and browse to http://<server-IP> and you should see the default TKL web landing page (or whatever you have replaced it with if you have already started work...)
sorry forgot to add i am trying to do this with the lamp appliance 13.0 and have already partitioned the second drive to ext4