0

I was wondering if it is possible to run a web server that has a small 80 GB hard drive for Ubuntu Server 13.04 and all the installations, etc. however have a separate 2 TB hard drive store the data.

How would I go about setting this up for Ubuntu and Apache work this? And if so, in the command line how would i access each drive.

Thanks, Stephen

2 Answers 2

1

I'm assuming that you want to put the data for your web sites on this external hard drive. The best way to do this would probably be to mount the 2TB hard drive in the web server directory, which I'll assume to be /var/www/.

Once you have a file system in the 2TB drive, you can mount it with the mount command temporary, then permanently in the /etc/fstab file. Assuming that the larger drive is /dev/sdb and the filesystem is /dev/sdb1, the command to mount it is

sudo mount /dev/sdb1 /var/www/

and the line to add to fstab would be

/dev/sdb1 /var/www ext4 defaults 0 0

Note that when mounting, the directory where you mount it needs to exist before hand, and should be empty (the previous contents of that directory will not be accessible after mounting, so if you already have something there, copy over the files to somewhere else, or mount /dev/sdb1 somewhere else first to copy over the files).

Mounting a drive makes it become part of the file system, and from apache's perspective the directory might as well be on the same drive.

Even if this answer is not exactly what you want, I hope that it gives enough insight into mounting for you to apply it to your specific purposes.

0

I would set up LVM2 on the extra disk and make a lv-'partition' for external data with 10-20% of its size. Then format and mount that on /srv, which are the mount point for server storage. If I would like to have a space for the web server I would create a directory /srv/web/www.mysite.com for the webserver. Sharing disk under /srv/fileserver/ etc.

If I had many disks I would make them an RAID-5 or RAID-1, and make the LVM on that.

# mark partition as a LVM2 storage
sudo pvcreate /dev/sdb1
# create a logical 'disk' of sdb1, you can later add more disks
sudo vgcreate --name datavg /dev/sdb1
# create a logical 'partition' in datavg. can be resized later
sudo lvcreate --size 100Mb --name srv datavg
# create file system which can be resized, ext4 is such
sudo mkfs.ext4 /dev/mapper/datavg--srv
# easy to create new volumes as you go
sudo lvcreate --size 1Gb --name www-mysite-com datavg
#  other file system that works are jfs and xfs. Use what you like
sudo mkfs.ext4 /dev/mapper/datavg--www-mysitew-com datavg
sudo mount /dev/mapper/datavg--srv /srv
# make mounting point
sudo mkdir -p /srv/web/www.mysitw.com
# mount web servers working area
sudo mount /dev/mapper/datavg--www.mysite.com /srv/web/www.mysite.com
# change owner to web server user and group
sudo chown -r www-data.www-data /srv/web/www.mysite.com

Edit /etc/fstab so /srv and /srv/web/we.mysite.com are mounted on each reboot.

Check out how to create a Apache website with the command a2ensite. And set that site to use /var/www.mysite.com as data dir. Configurations should be in /etc/apache2/sites-available

New webserver etc, make new logical volume etc

(I'm doing this from memory, so you have to check the commands)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .