Ok, so I am a n00b. Keep that in mind. My Ubuntu computer is running an Apache2 server for basic web hosting and file transfer. If I wanted to use an external hard drive for it, how would I go about it? I mean, the var, www, and html folders are stored in the computer's storage. I want to combine the storage from the internal computer and external drive for total storage for the /var/www
2 Answers
- You should mount the drive and make sure it mounts automatically after a restart.
- You can use a symlink to the folder on the external drive. You could link directly in the vhost or apache config, but using symlinks simplifies most of the time.
- You need to set proper rights so Apache can write to that folder. On Ubuntu, Apache is run as user www-data, so make sure www-data can write to that folder.
- 2,535
I specify beforehand that I have absolutely no experience with Apache
Having said that you might want to do the following
Before connecting the external drive
sudo fdisk -l
Repeat the above command after connecting the drive
You will see a new entry in the output (probably at the end). Observe the device column of this entry. This is the block file that represents your drive. It will be something like /dev/yourdrivesfile .
Now make a folder in /var/www and then mount the drive on it by:
sudo mount -o defaults /dev/yourdrivesfile /var/www/yourfolder
Before you do this try learning about the mount command and its options, you might need them. man mount and info mount will also help.
Changing permissions of your folder to allow www-data (Apache) to write to it might be something like sudo chown www-data /var/www/yourfolder, though I 'm not sure about this part.
Hope this helps with the mounting atleast.
- 221