[
314
]
Replace
myserver
with either your server's hostname or its IP address,
documents
with the name of the actual share on the server, and
/mnt/documents
with the path
on your local server where you want to mount the share. From this point forward,
you should be able to access the contents of the
documents
export on your file server.
Notice, however, that the exported directory on the server was
/exports/documents
,
but we only asked for
/documents
instead of the full path with the example
mount
command. The reason this works is because we identified an export
root
of
/exports
. To save you from flipping back, here's the first line from the
/etc/exports
file, where we identified our export
root
:
/exports *(ro,fsid=0,no_subtree_check)
With the export
root
, we basically set the base directory for our NFS exports. We
set it as read-only (
ro
), because we don't want anyone making any changes to
the
/exports
directory itself. Other directories within
/exports
have their own
permissions and will thus override the
ro
setting on a per-export basis, so there's no
real reason to set our export
root
as anything other than read-only. With our export
root
set, we don't have to call out the entire path of the export when we mount it;
we only need the directory name. This is why we can mount an NFS export from
myserver:/documents
instead of having to type the entire path. While this does save
us a bit of typing, it's also useful because from the user's perspective, they aren't
required to know anything about the underlying filesystem on the server. There's
simply no value in the user having to memorize the fact that the server is sharing a
document's directory from
/exports
; all they're interested in is getting
to their data.
Another benefit is if we ever need to move our export
root
to a different directory
(during a maintenance period), our users won't have to change their configuration
to reference the new place; they'll only need to unmount and remount the exports.
So, at this point, you'll have three directories being exported from your file server,
and you can always add others as you go. However, whenever you add a new
export, it won't be automatically added and read by NFS. You can restart NFS to
activate new exports, but that's not really a good idea while users may be connected
to them, since that will disrupt their access. Thankfully, the following command will
cause NFS to reread the
/etc/exports
file without disrupting existing connections.
This will allow you to activate new exports immediately without having to wait for
users to finish what they're working on:
sudo exportfs -a
With this section out of the way, you should be able to export a directory from your
Ubuntu Server, and then mount that export on another Linux machine. Feel free
to practice creating and mounting exports until you get the hang of it. In addition,
you should familiarize yourself with a few additional options and settings that are
allowable in the
/etc/exports
file, after consulting the man page on exports.
Chapter 12
Do'stlaringiz bilan baham: |