[Clug-tech] Serve HTTP files from server via NFS over NFS

Mailing Lists lists at vlietwerkz.ca
Wed Jul 28 22:43:30 PDT 2010


On 2010/07/28 8:56 PM, Gustin Johnson wrote:
> On 10-07-28 07:15 PM, clug-lists at vlietwerkz.ca wrote:
>>  Hey all,
>>
>> I'm wondering if anyone's ever tried this or might know why it's not
>> working...
>>
>> 2 CentOS 5 servers
>> One hosting an HTTP daemon: "prod"
>> One hosting files: "archive"
>>
>> 1 D-LINK DNS 328 NAS hosting large files accessible via "archive".  This
>> one is know as "nas"
>>
>> I'm trying to serve files from "nas" via the httpd service on "prod". 
>>
>> "prod" can access an NFS share on "archive"
>>
>> within that share location, there is another NFS mount pointing to files
>> on "nas"
>>
>> web client --> "prod" --> "archive" --> "nas" --> (big files)
>>
>> I used  # mount --bind /var/data/mirror/bigfiles /var/data/nas/bigfiles
>> to put the files that are on the NAS into the mirror directory.  
>> Well...  it didn't work.  The directory /var/data/mirror/bigfiles
> 
> That is not specific enough.  Are there errors in the apache logs
> (likely permission denied errors).  Since you are using NFS your UIDs
> and GUIDs need to be the same for all 3 machines.  You could just chmod
> 777 the files but just thinking about that will keep me up at night.

No, there aren't any errors in the httpd logs, or any of the other logs,
nor will I be setting chmod 777 or anything else quite so rash as that.

> 
>> doesn't show up on the web site.  Kind of at a bit of a loss here - I
>> was under the impression that when you bound a directory using "# mount
>> --bind", that it was indistinguishable from an actual folder.
Yes, the above is wrong - was having a moment.

# mount -o bind /var/data/mirror/bigfiles /var/data/nas/bigfiles

Been working on this since the first message, and there are new details.

The contents show just fine in the file system on the server "archive",
but they don't show up in the same location on "prod".  This says to me
that there is an issue with viewing files via an NFS share which has a
bind olddir/newdir mapping to another NFS share.

"prod"/var/data/mirror/bigfiles --(nfs share)-->
"archive"/var/data/mirror/bigfiles --(mount -o bind ...)-->
"archive"/var/data/nas/bigfiles --(nfs share)--> "nas"/bigfiles

So...  The structure's a little convoluted and cryptic (yes, I have my
reasons), but if you can follow that structure, the issue appears to be
either the NFS share between "prod" and "archive" in relation to the
"mount -o bind" directory.  I feel this is the case as the files are
visible when looking under "archive"/var/data/mirror/bigfiles, but not
when looking under "prod"/var/data/mirror/bigfiles

I've put in place a work-around of just referencing the data on the NAS
directly as a read-only share, but that's less than optimal for my
desired scenario.

Regards,
Andrew Vliet

>>
> I think you are confused here.  From the mount man page:
> 
> The bind mounts.
> Since Linux 2.4.0 it is possible to remount part of the file hierarchy
> somewhere else. The call is
>     mount --bind olddir newdir
>          or shortoption
>     mount -B olddir newdir
>          or fstab entry is:
>     /olddir /newdir none bind
> 
> After this call the same contents is accessible in two places.  One can
> also remount a single file (on a single file).
> 
> This call attaches only (part of) a single filesystem, not possible
> submounts. The entire file hierarchy including submounts is attached a
> second place using
>      mount --rbind olddir newdir
>          or shortoption
>      mount -R olddir newdir
> 
> Note  that  the  filesystem  mount  options  will  remain  the same as
> those on the original mount point, and cannot be changed by passing the
> -o option along with --bind/--rbind. The mount options can be changed by
> a separate remount command, for example:
> 
>      mount --bind olddir newdir
>      mount -o remount,ro newdir
> 
> 
>> Any thoughts anyone?
> 
> Hth,
> 
> 
> 
> 
> _______________________________________________
> clug-tech mailing list
> clug-tech at clug.ca
> http://clug.ca/mailman/listinfo/clug-tech_clug.ca




More information about the clug-tech mailing list