Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a Webserver, and I would like to move some of the static files for the web application off to a remote server, yet still have them accessible.

Is there a way to have (Server A) mount a folder from (Server B) as if it were a local drive? Or simply a mounted partition? Basically so my web app can write to the remote drive via something like /mount/remotefolder ??

Both servers are running CentOS, however in two geographically separate locations.

share|improve this question

2 Answers 2

sshfs is what you're looking for. http://fuse.sourceforge.net/sshfs.html -- you can even use fstab entries to automount it on boot, or set it not to mount, but then you can just do mount /pre/defined/mount/point to mount it. sshfs can be slow, but it's definitely secure. It requires fuse to be active, either as a kernel module/compiled into kernel, or as a userspace program.

I have the following line in my .bashrc:

alias xxr-sfs="sshfs xxr:/var/www/localhost/htdocs ~/xxr"

And xxr is defined in my ~/.ssh/config file:

Host xxr
HostName xxr
user mark

(stuff above has obviously been renamed for my privacy)

Then if I want to mount it, I just type xxr-sfs to mount it.

share|improve this answer
    
Thank you, i'll take a look in to it. –  Joel Jul 11 '11 at 13:07

The short answer to your question would be NFS, I think. Alternatively, for a more fancy setup, you could have the two servers share a DRBD volume.

However, I wonder what's wrong with HTTP as a file access protocol? Can't server B have it's own web server and serve its files for itself? Split your webapp so that the part that processes the files resides on server B?

Update:

I didn't read OP carefully enough. If "geographically separate locations" means long latency, both drbd and nfs may be suboptimal, depending on the exact use case. If there is more than a 50 ms latency between the two locations, I would try to use different web servers that both talk directly to the end user, if possible.

share|improve this answer
    
Bandwidth in Australia is quite pricey, so I would like to move the non-critical elements such as Video and Media to a US based server whilst keeping the critical elements of the web app locally. –  Joel Jul 11 '11 at 13:08

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.