*** FOR LINUX EXPERTS ONLY ***

WARNING: If you don't trust me (you shouldn't) or yourself, please try this first in a virtual box or fail-proof test environment. It is entirely up to you to verify this working properly. If you are not a Linux expert, you probably are better off with asking some help!

Many users of this plugin have asked, how to move their images from one place to another, preferably by using a FTP connection to their media server. This guide will show you how to install a local mount point to a remote server via FTP. I have tried this on two Linux Ubuntu 10.04 LTS production boxes, one holding the mount and the other keeping the images and, mainly, large videos.

All you need is a media server (may be a Windows server, as well) at some place with a FTP connection, and a Linux web server. On Linux Ubuntu you would issue a:

# aptitude install curlftpfs

but on other systems you may use apt-get, yum or rpm. All what matters is installing curlftpfs.

Once installed, you would create typically a new directory, but for moving files from one place to another, you would use just "the one" folder you already have, for example:

/var/www/domain.tld/htdocs/images/imported

The imported folder would typically hold hundreds or thousands of large files, which you would like to move elsewhere. First, you would now move or copy all files to the new server destination, and then create the FTP mount point as follows:

# curlftpfs -o allow_other,nonempty ftp_user:[email protected]/anywhere/you/want/ /var/www/domain.tld/htdocs/images/imported

If you have an empty folder now, you would not need to specify nonempty, thus issue:

# curlftpfs -o allow_other ftp_user:[email protected]/anywhere/you/want/ /var/www/domain.tld/htdocs/images/imported

ftp_user is the username and ftp_password the password to connect to your media server. Since passwords are clear, make sure to use passwords different from your root account "here" and/or "there". your.media.server would be your host name for all the files and folders, and an optional /anywhere/you/want/ would indicate a subfolder on the "other" machine. /var/www/domain.tld/htdocs/images/imported indicates the mount point. It makes no difference with or without a leading slash of your folders.

If everything went right, you are now able to play with your FTP connection, which essentially behaves as a normal folder:

# cd /var/www/domain.tld/htdocs/images/imported
# ls -lA
# mkdir abc
# touch abc.txt
# ls -lA
# df -h
# umount /var/www/domain.tld/htdocs/images/imported
# mount /var/www/domain.tld/htdocs/images/imported

and so on. Somebody now starts to dream ... what a great connection

Now, we have to add this feature to the fstab in order to have this feature always available. If the remote server isn't available at (re)boot time of this server, obviously the mount will not work. We open /etc/fstab and add this line at the end:

curlftpfs#ftp://ftp_user:[email protected]/anywhere/you/want/ /var/www/domain.tld/htdocs/images/imported fuse defaults 0 0

Now, you would typically add a redirect to your .htaccess file from your normal image folder to your media server. Of course, it must have a web server, too, eventually at the specified location:

RedirectMatch ^/images/imported/(.*) http://your.media.server/anywhere/you/want/$1

At your media server you may monitor the new function by watching your log, for example:

# tail -f /var/www/your.media.server/weblogs/access.log

curlftpfs offers a whole lot of additional features, including SSH, proxy and write protection, which may e useful in come contexts. Also, please make sure to exclude the mount point from your round-robin rsync or your backup, since rsync and backup may pull in a lot more traffic than expected.