1

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

marked as duplicate by Rod Smith, Eric Carvalho, Volker Siegel, Maythux, Anwar Jun 13 '15 at 17:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You want the /var/www on the external drive? Read stackoverflow.com/questions/5891802/… – s3lph Jun 10 '15 at 11:53
  • Or you want to add files to /var/www from the external drive? Please clarify. – Elder Geek Jun 10 '15 at 11:54
  • @the_Seppi Nope. I want to combine the storage from the internal computer and external drive for total storage for the /var/www – Mr. Leopold Jun 10 '15 at 12:06
  • @ElderGeek I want to combine the storage from the internal computer and external drive for total storage for the /var/www – Mr. Leopold Jun 10 '15 at 12:07
  • In future please edit your question to add clarifying information. I've done it for you this time. – Elder Geek Jun 10 '15 at 12:38
0
  1. You should mount the drive and make sure it mounts automatically after a restart.
  2. 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.
  3. 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.
  • I am sorry but I am a n00b. Can you please explain what this would do? (Because there has been confusion on what my goal is; check the comments in the original post. I clarified there.) – Mr. Leopold Jun 10 '15 at 12:08
  • Mounting means that the drive is accessible by the OS. It's like the drive-letter in Windows, which can change for a given USB drive. This can change for Ubuntu as well, so you should make sure that this won't happen. Google for mounting external drives! Symlinks are pointers that point to another location on your disk or on another disk. You can replace the www in /var/www with a symlink to /var/www in the external drive. First solve (1) for this! (3) Change rights with chmod and chown commands. Google those as well! – SPRBRN Jun 10 '15 at 15:40
0

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.

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