xref: /freebsd/usr.sbin/nfsd/pnfsserver.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1d47b2068SRick Macklem.\" Copyright (c) 2018 Rick Macklem
2d47b2068SRick Macklem.\"
3d47b2068SRick Macklem.\" Redistribution and use in source and binary forms, with or without
4d47b2068SRick Macklem.\" modification, are permitted provided that the following conditions
5d47b2068SRick Macklem.\" are met:
6d47b2068SRick Macklem.\" 1. Redistributions of source code must retain the above copyright
7d47b2068SRick Macklem.\"    notice, this list of conditions and the following disclaimer.
8d47b2068SRick Macklem.\" 2. Redistributions in binary form must reproduce the above copyright
9d47b2068SRick Macklem.\"    notice, this list of conditions and the following disclaimer in the
10d47b2068SRick Macklem.\"    documentation and/or other materials provided with the distribution.
11d47b2068SRick Macklem.\"
12d47b2068SRick Macklem.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13d47b2068SRick Macklem.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14d47b2068SRick Macklem.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15d47b2068SRick Macklem.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16d47b2068SRick Macklem.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17d47b2068SRick Macklem.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18d47b2068SRick Macklem.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19d47b2068SRick Macklem.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20d47b2068SRick Macklem.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21d47b2068SRick Macklem.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22d47b2068SRick Macklem.\" SUCH DAMAGE.
23d47b2068SRick Macklem.\"
2494498988SRick Macklem.Dd December 20, 2019
25d47b2068SRick Macklem.Dt PNFSSERVER 4
26d47b2068SRick Macklem.Os
27d47b2068SRick Macklem.Sh NAME
28d47b2068SRick Macklem.Nm pNFSserver
2994498988SRick Macklem.Nd NFS Version 4.1 and 4.2 Parallel NFS Protocol Server
30d47b2068SRick Macklem.Sh DESCRIPTION
314c87085dSGordon BerglingA set of
324c87085dSGordon Bergling.Fx
334c87085dSGordon Berglingservers may be configured to provide a
34d47b2068SRick Macklem.Xr pnfs 4
35d47b2068SRick Macklemservice.
364c87085dSGordon BerglingOne
374c87085dSGordon Bergling.Fx
384c87085dSGordon Berglingsystem needs to be configured as a MetaData Server (MDS) and
394c87085dSGordon Berglingat least one additional
404c87085dSGordon Bergling.Fx
414c87085dSGordon Berglingsystem needs to be configured as one or
42d47b2068SRick Macklemmore Data Servers (DS)s.
43d47b2068SRick Macklem.Pp
444c87085dSGordon BerglingThese
454c87085dSGordon Bergling.Fx
464c87085dSGordon Berglingsystems are configured to be NFSv4.1 and NFSv4.2
4794498988SRick Macklemservers, see
48d47b2068SRick Macklem.Xr nfsd 8
49d47b2068SRick Macklemand
50d47b2068SRick Macklem.Xr exports 5
5194498988SRick Macklemif you are not familiar with configuring a NFSv4.n server.
5294498988SRick MacklemAll DS(s) and the MDS should support NFSv4.2 as well as NFSv4.1.
5394498988SRick MacklemMixing an MDS that supports NFSv4.2 with any DS(s) that do not support
5494498988SRick MacklemNFSv4.2 will not work correctly.
5594498988SRick MacklemAs such, all DS(s) must be upgraded from
5694498988SRick Macklem.Fx 12
5794498988SRick Macklemto
5894498988SRick Macklem.Fx 13
5994498988SRick Macklembefore upgrading the MDS.
60d47b2068SRick Macklem.Sh DS server configuration
6194498988SRick MacklemThe DS(s) need to be configured as NFSv4.1 and NFSv4.2 server(s),
6294498988SRick Macklemwith a top level exported
63d47b2068SRick Macklemdirectory used for storage of data files.
64d47b2068SRick MacklemThis directory must be owned by
65d47b2068SRick Macklem.Dq root
66d47b2068SRick Macklemand would normally have a mode of
67d47b2068SRick Macklem.Dq 700 .
68d47b2068SRick MacklemWithin this directory there needs to be additional directories named
69d47b2068SRick Macklemds0,...,dsN (where N is 19 by default) also owned by
70d47b2068SRick Macklem.Dq root
71d47b2068SRick Macklemwith mode
72d47b2068SRick Macklem.Dq 700 .
73d47b2068SRick MacklemThese are the directories where the data files are stored.
74d47b2068SRick MacklemThe following command can be run by root when in the top level exported
75d47b2068SRick Macklemdirectory to create these subdirectories.
76d47b2068SRick Macklem.Bd -literal -offset indent
77d47b2068SRick Macklemjot -w ds 20 0 | xargs mkdir -m 700
78d47b2068SRick Macklem.Ed
79d47b2068SRick Macklem.sp
80d47b2068SRick MacklemNote that
81d47b2068SRick Macklem.Dq 20
82d47b2068SRick Macklemis the default and can be set to a larger value on the MDS as shown below.
83d47b2068SRick Macklem.sp
84d47b2068SRick MacklemThe top level exported directory used for storage of data files must be
85d47b2068SRick Macklemexported to the MDS with the
86d47b2068SRick Macklem.Dq maproot=root sec=sys
87d47b2068SRick Macklemexport options so that the MDS can create entries in these subdirectories.
88d47b2068SRick MacklemIt must also be exported to all pNFS aware clients, but these clients do
89d47b2068SRick Macklemnot require the
90d47b2068SRick Macklem.Dq maproot=root
91d47b2068SRick Macklemexport option and this directory should be exported to them with the same
92d47b2068SRick Macklemoptions as used by the MDS to export file system(s) to the clients.
93d47b2068SRick Macklem.Pp
944c87085dSGordon BerglingIt is possible to have multiple DSs on the same
954c87085dSGordon Bergling.Fx
964c87085dSGordon Berglingsystem, but each
97d47b2068SRick Macklemof these DSs must have a separate top level exported directory used for storage
98d47b2068SRick Macklemof data files and each
99d47b2068SRick Macklemof these DSs must be mountable via a separate IP address.
100d47b2068SRick MacklemAlias addresses can be set on the DS server system for a network
101d47b2068SRick Mackleminterface via
102d47b2068SRick Macklem.Xr ifconfig 8
103d47b2068SRick Macklemto create these different IP addresses.
104d47b2068SRick MacklemMultiple DSs on the same server may be useful when data for different file systems
1054c87085dSGordon Berglingon the MDS are being stored on different file system volumes on the
1064c87085dSGordon Bergling.Fx
107d47b2068SRick MacklemDS system.
108d47b2068SRick Macklem.Sh MDS server configuration
1094c87085dSGordon BerglingThe MDS must be a separate
1104c87085dSGordon Bergling.Fx
1114c87085dSGordon Berglingsystem from the
1124c87085dSGordon Bergling.Fx
1134c87085dSGordon BerglingDS system(s) and
114d47b2068SRick MacklemNFS clients.
11594498988SRick MacklemIt is configured as a NFSv4.1 and NFSv4.2 server with
11694498988SRick Macklemfile system(s) exported to clients.
117d47b2068SRick MacklemHowever, the
118d47b2068SRick Macklem.Dq -p
119d47b2068SRick Macklemcommand line argument for
120d47b2068SRick Macklem.Xr nfsd
121d47b2068SRick Macklemis used to indicate that it is running as the MDS for a pNFS server.
122d47b2068SRick Macklem.Pp
123d47b2068SRick MacklemThe DS(s) must all be mounted on the MDS using the following mount options:
124d47b2068SRick Macklem.Bd -literal -offset indent
12594498988SRick Macklemnfsv4,minorversion=2,soft,retrans=2
126d47b2068SRick Macklem.Ed
127d47b2068SRick Macklem.sp
128d47b2068SRick Macklemso that they can be defined as DSs in the
129d47b2068SRick Macklem.Dq -p
130d47b2068SRick Macklemoption.
131d47b2068SRick MacklemNormally these mounts would be entered in the
132d47b2068SRick Macklem.Xr fstab 5
133d47b2068SRick Macklemon the MDS.
134d47b2068SRick MacklemFor example, if there are four DSs named nfsv4-data[0-3], the
135d47b2068SRick Macklem.Xr fstab 5
136d47b2068SRick Macklemlines might look like:
137d47b2068SRick Macklem.Bd -literal -offset
13894498988SRick Macklemnfsv4-data0:/ /data0 nfs rw,nfsv4,minorversion=2,soft,retrans=2 0 0
13994498988SRick Macklemnfsv4-data1:/ /data1 nfs rw,nfsv4,minorversion=2,soft,retrans=2 0 0
14094498988SRick Macklemnfsv4-data2:/ /data2 nfs rw,nfsv4,minorversion=2,soft,retrans=2 0 0
14194498988SRick Macklemnfsv4-data3:/ /data3 nfs rw,nfsv4,minorversion=2,soft,retrans=2 0 0
142d47b2068SRick Macklem.Ed
143d47b2068SRick Macklem.sp
144d47b2068SRick MacklemThe
145d47b2068SRick Macklem.Xr nfsd 8
146d47b2068SRick Macklemcommand line option
147d47b2068SRick Macklem.Dq -p
148d47b2068SRick Macklemindicates that the NFS server is a pNFS MDS and specifies what
149d47b2068SRick MacklemDSs are to be used.
150d47b2068SRick Macklem.br
151d47b2068SRick MacklemFor the above
152d47b2068SRick Macklem.Xr fstab 5
153d47b2068SRick Macklemexample, the
154d47b2068SRick Macklem.Xr nfsd 8
155d47b2068SRick Macklemnfs_server_flags line in your
156d47b2068SRick Macklem.Xr rc.conf 5
157d47b2068SRick Macklemmight look like:
158d47b2068SRick Macklem.Bd -literal -offset
159d47b2068SRick Macklemnfs_server_flags="-u -t -n 128 -p nfsv4-data0:/data0,nfsv4-data1:/data1,nfsv4-data2:/data2,nfsv4-data3:/data3"
160d47b2068SRick Macklem.Ed
161d47b2068SRick Macklem.sp
162d47b2068SRick MacklemThis example specifies that the data files should be distributed over the
163d47b2068SRick Macklemfour DSs and File layouts will be issued to pNFS enabled clients.
164d47b2068SRick MacklemIf issuing Flexible File layouts is desired for this case, setting the sysctl
165d47b2068SRick Macklem.Dq vfs.nfsd.default_flexfile
166d47b2068SRick Macklemnon-zero in your
167d47b2068SRick Macklem.Xr sysctl.conf 5
168d47b2068SRick Macklemfile will make the
169d47b2068SRick Macklem.Nm
170d47b2068SRick Macklemdo that.
171d47b2068SRick Macklem.br
172d47b2068SRick MacklemAlternately, this variant of
173d47b2068SRick Macklem.Dq nfs_server_flags
174d47b2068SRick Macklemwill specify that two way mirroring is to be done, via the
175d47b2068SRick Macklem.Dq -m
176d47b2068SRick Macklemcommand line option.
177d47b2068SRick Macklem.Bd -literal -offset
178d47b2068SRick Macklemnfs_server_flags="-u -t -n 128 -p nfsv4-data0:/data0,nfsv4-data1:/data1,nfsv4-data2:/data2,nfsv4-data3:/data3 -m 2"
179d47b2068SRick Macklem.Ed
180d47b2068SRick Macklem.sp
181d47b2068SRick MacklemWith two way mirroring, the data file for each exported file on the MDS
182d47b2068SRick Macklemwill be stored on two of the DSs.
183d47b2068SRick MacklemWhen mirroring is enabled, the server will always issue Flexible File layouts.
184d47b2068SRick Macklem.Pp
185d47b2068SRick MacklemIt is also possible to specify which DSs are to be used to store data files for
186d47b2068SRick Macklemspecific exported file systems on the MDS.
187d47b2068SRick MacklemFor example, if the MDS has exported two file systems
188d47b2068SRick Macklem.Dq /export1
189d47b2068SRick Macklemand
190d47b2068SRick Macklem.Dq /export2
191d47b2068SRick Macklemto clients, the following variant of
192d47b2068SRick Macklem.Dq nfs_server_flags
193d47b2068SRick Macklemwill specify that data files for
194d47b2068SRick Macklem.Dq /export1
195d47b2068SRick Macklemwill be stored on nfsv4-data0 and nfsv4-data1, whereas the data files for
196d47b2068SRick Macklem.Dq /export2
197d47b2068SRick Macklemwill be store on nfsv4-data2 and nfsv4-data3.
198d47b2068SRick Macklem.Bd -literal -offset
199d47b2068SRick Macklemnfs_server_flags="-u -t -n 128 -p nfsv4-data0:/data0#/export1,nfsv4-data1:/data1#/export1,nfsv4-data2:/data2#/export2,nfsv4-data3:/data3#/export2"
200d47b2068SRick Macklem.Ed
201d47b2068SRick Macklem.sp
202d47b2068SRick MacklemThis can be used by system administrators to control where data files are
203d47b2068SRick Macklemstored and might be useful for control of storage use.
204d47b2068SRick MacklemFor this case, it may be convenient to co-locate more than one of the DSs
2054c87085dSGordon Berglingon the same
2064c87085dSGordon Bergling.Fx
2074c87085dSGordon Berglingserver, using separate file systems on the DS system
208d47b2068SRick Macklemfor storage of the respective DS's data files.
209d47b2068SRick MacklemIf mirroring is desired for this case, the
210d47b2068SRick Macklem.Dq -m
211d47b2068SRick Macklemoption also needs to be specified.
212d47b2068SRick MacklemThere must be enough DSs assigned to each exported file system on the MDS
213d47b2068SRick Macklemto support the level of mirroring.
214d47b2068SRick MacklemThe above example would be fine for two way mirroring, but four way mirroring
215d47b2068SRick Macklemwould not work, since there are only two DSs assigned to each exported file
216d47b2068SRick Macklemsystem on the MDS.
217d47b2068SRick Macklem.Pp
218d47b2068SRick MacklemThe number of subdirectories in each DS is defined by the
219d47b2068SRick Macklem.Dq vfs.nfs.dsdirsize
220d47b2068SRick Macklemsysctl on the MDS.
221d47b2068SRick MacklemThis value can be increased from the default of 20, but only when the
222d47b2068SRick Macklem.Xr nfsd 8
223d47b2068SRick Macklemis not running and after the additional ds20,... subdirectories have been
224d47b2068SRick Macklemcreated on all the DSs.
225d47b2068SRick MacklemFor a service that will store a large number of files this sysctl should be
226d47b2068SRick Macklemset much larger, to avoid the number of entries in a subdirectory from
227d47b2068SRick Macklemgetting too large.
228d47b2068SRick Macklem.Sh Client mounts
2294c87085dSGordon BerglingOnce operational, NFSv4.1 or NFSv4.2
2304c87085dSGordon Bergling.Fx
2314c87085dSGordon Berglingclient mounts
23294498988SRick Macklemdone with the
233d47b2068SRick Macklem.Dq pnfs
234d47b2068SRick Macklemoption should do I/O directly on the DSs.
235d47b2068SRick MacklemThe clients mounting the MDS must be running the
236d47b2068SRick Macklem.Xr nfscbd
237d47b2068SRick Macklemdaemon for pNFS to work.
238d47b2068SRick MacklemSet
239d47b2068SRick Macklem.Bd -literal -offset indent
240d47b2068SRick Macklemnfscbd_enable="YES"
241d47b2068SRick Macklem.Ed
242d47b2068SRick Macklem.sp
243d47b2068SRick Macklemin the
244d47b2068SRick Macklem.Xr rc.conf 5
245d47b2068SRick Macklemon these clients.
246d47b2068SRick MacklemNon-pNFS aware clients or NFSv3 mounts will do all I/O RPCs on the MDS,
247d47b2068SRick Macklemwhich acts as a proxy for the appropriate DS(s).
248d47b2068SRick Macklem.Sh Backing up a pNFS service
249d47b2068SRick MacklemSince the data is separated from the metadata, the simple way to back up
250d47b2068SRick Macklema pNFS service is to do so from an NFS client that has the service mounted
251d47b2068SRick Macklemon it.
252d47b2068SRick MacklemIf you back up the MDS exported file system(s) on the MDS, you must do it
253d47b2068SRick Macklemin such a way that the
254d47b2068SRick Macklem.Dq system
255d47b2068SRick Macklemnamespace extended attributes get backed up.
256d47b2068SRick Macklem.Sh Handling of failed mirrored DSs
257d47b2068SRick MacklemWhen a mirrored DS fails, it can be disabled one of three ways:
258d47b2068SRick Macklem.sp
259d47b2068SRick Macklem1 - The MDS detects a problem when trying to do proxy
260d47b2068SRick Macklemoperations on the DS.
261d47b2068SRick MacklemThis can take a couple of minutes
262d47b2068SRick Macklemafter the DS failure or network partitioning occurs.
263d47b2068SRick Macklem.sp
264d47b2068SRick Macklem2 - A pNFS client can report an I/O error that occurred for a DS to the MDS in
265d47b2068SRick Macklemthe arguments for a LayoutReturn operation.
266d47b2068SRick Macklem.sp
267d47b2068SRick Macklem3 - The system administrator can perform the pnfsdskill(8) command on the MDS
2681f572209SGordon Berglingto disable it.
2691f572209SGordon BerglingIf the system administrator does a pnfsdskill(8) and it fails with ENXIO
2701f572209SGordon Bergling(Device not configured) that normally means the DS was already
2711f572209SGordon Berglingdisabled via #1 or #2.
2721f572209SGordon BerglingSince doing this is harmless, once a system administrator knows that
2731f572209SGordon Berglingthere is a problem with a mirrored DS, doing the command is recommended.
274d47b2068SRick Macklem.sp
275d47b2068SRick MacklemOnce a system administrator knows that a mirrored DS has malfunctioned
276d47b2068SRick Macklemor has been network partitioned, they should do the following as root/su
277d47b2068SRick Macklemon the MDS:
278d47b2068SRick Macklem.Bd -literal -offset indent
279d47b2068SRick Macklem# pnfsdskill <mounted-on-path-of-DS>
280d47b2068SRick Macklem# umount -N <mounted-on-path-of-DS>
281d47b2068SRick Macklem.Ed
282d47b2068SRick Macklem.sp
283d47b2068SRick MacklemNote that the <mounted-on-path-of-DS> must be the exact mounted-on path
284d47b2068SRick Macklemstring used when the DS was mounted on the MDS.
285d47b2068SRick Macklem.Pp
286d47b2068SRick MacklemOnce the mirrored DS has been disabled, the pNFS service should continue to
2871f572209SGordon Berglingfunction, but file updates will only happen on the DS(s) that have not been disabled.
2881f572209SGordon BerglingAssuming two way mirroring, that implies the one DS of the pair stored in the
289d47b2068SRick Macklem.Dq pnfsd.dsfile
290d47b2068SRick Macklemextended attribute for the file on the MDS, for files stored on the disabled DS.
291d47b2068SRick Macklem.Pp
292d47b2068SRick MacklemThe next step is to clear the IP address in the
293d47b2068SRick Macklem.Dq pnfsd.dsfile
294d47b2068SRick Macklemextended attribute on all files on the MDS for the failed DS.
295d47b2068SRick MacklemThis is done so that, when the disabled DS is repaired and brought back online,
296d47b2068SRick Macklemthe data files on this DS will not be used, since they may be out of date.
297d47b2068SRick MacklemThe command that clears the IP address is
298d47b2068SRick Macklem.Xr pnfsdsfile 8
299d47b2068SRick Macklemwith the
300d47b2068SRick Macklem.Dq -r
301d47b2068SRick Macklemoption.
302d47b2068SRick Macklem.Bd -literal -offset
303d47b2068SRick MacklemFor example:
304d47b2068SRick Macklem# pnfsdsfile -r nfsv4-data3 yyy.c
305d47b2068SRick Macklemyyy.c:	nfsv4-data2.home.rick	ds0/207508569ff983350c000000ec7c0200e4c57b2e0000000000000000	0.0.0.0	ds0/207508569ff983350c000000ec7c0200e4c57b2e0000000000000000
306d47b2068SRick Macklem.Ed
307d47b2068SRick Macklem.sp
308d47b2068SRick Macklemreplaces nfsv4-data3 with an IPv4 address of 0.0.0.0, so that nfsv4-data3
309d47b2068SRick Macklemwill not get used.
310d47b2068SRick Macklem.Pp
311d47b2068SRick MacklemNormally this will be called within a
312d47b2068SRick Macklem.Xr find 1
313d47b2068SRick Macklemcommand for all regular
314d47b2068SRick Macklemfiles in the exported directory tree and must be done on the MDS.
315d47b2068SRick MacklemWhen used with
316d47b2068SRick Macklem.Xr find 1 ,
317d47b2068SRick Macklemyou will probably also want the
318d47b2068SRick Macklem.Dq -q
319d47b2068SRick Macklemoption so that it won't spit out the results for every file.
320d47b2068SRick MacklemIf the disabled/repaired DS is nfsv4-data3, the commands done on the MDS
321d47b2068SRick Macklemwould be:
322d47b2068SRick Macklem.Bd -literal -offset
323d47b2068SRick Macklem# cd <top-level-exported-dir>
324d47b2068SRick Macklem# find . -type f -exec pnfsdsfile -q -r nfsv4-data3 {} \;
325d47b2068SRick Macklem.Ed
326d47b2068SRick Macklem.sp
327d47b2068SRick MacklemThere is a problem with the above command if the file found by
328d47b2068SRick Macklem.Xr find 1
329d47b2068SRick Macklemis renamed or unlinked before the
330d47b2068SRick Macklem.Xr pnfsdsfile 8
331d47b2068SRick Macklemcommand is done on it.
332d47b2068SRick MacklemThis should normally generate an error message.
333d47b2068SRick MacklemA simple unlink is harmless
334d47b2068SRick Macklembut a link/unlink or rename might result in the file not having been processed
335d47b2068SRick Macklemunder its new name.
336d47b2068SRick MacklemTo check that all files have their IP addresses set to 0.0.0.0 these
337d47b2068SRick Macklemcommands can be used (assuming the
338d47b2068SRick Macklem.Xr sh 1
339d47b2068SRick Macklemshell):
340d47b2068SRick Macklem.Bd -literal -offset
341d47b2068SRick Macklem# cd <top-level-exported-dir>
342d47b2068SRick Macklem# find . -type f -exec pnfsdsfile {} \; | sed "/nfsv4-data3/!d"
343d47b2068SRick Macklem.Ed
344d47b2068SRick Macklem.sp
345d47b2068SRick MacklemAny line(s) printed require the
346d47b2068SRick Macklem.Xr pnfsdsfile 8
347d47b2068SRick Macklemwith
348d47b2068SRick Macklem.Dq -r
349d47b2068SRick Macklemto be done again.
350d47b2068SRick MacklemOnce this is done, the replaced/repaired DS can be brought back online.
351d47b2068SRick MacklemIt should have empty ds0,...,dsN directories under the top level exported
352d47b2068SRick Macklemdirectory for storage of data files just like it did when first set up.
353d47b2068SRick MacklemMount it on the MDS exactly as you did before disabling it.
354d47b2068SRick MacklemFor the nfsv4-data3 example, the command would be:
355d47b2068SRick Macklem.Bd -literal -offset
35694498988SRick Macklem# mount -t nfs -o nfsv4,minorversion=2,soft,retrans=2 nfsv4-data3:/ /data3
357d47b2068SRick Macklem.Ed
358d47b2068SRick Macklem.sp
359d47b2068SRick MacklemThen restart the nfsd to re-enable the DS.
360d47b2068SRick Macklem.Bd -literal -offset
361d47b2068SRick Macklem# /etc/rc.d/nfsd restart
362d47b2068SRick Macklem.Ed
363d47b2068SRick Macklem.sp
364d47b2068SRick MacklemNow, new files can be stored on nfsv4-data3,
365d47b2068SRick Macklembut files with the IP address zeroed out on the MDS will not yet use the
366d47b2068SRick Macklemrepaired DS (nfsv4-data3).
367d47b2068SRick MacklemThe next step is to go through the exported file tree on the MDS and,
368d47b2068SRick Macklemfor each of the
369d47b2068SRick Macklemfiles with an IPv4 address of 0.0.0.0 in its extended attribute, copy the file
370d47b2068SRick Macklemdata to the repaired DS and re-enable use of this mirror for it.
371d47b2068SRick MacklemThis command for copying the file data for one MDS file is
372d47b2068SRick Macklem.Xr pnfsdscopymr 8
373d47b2068SRick Macklemand it will also normally be used in a
374d47b2068SRick Macklem.Xr find 1 .
375d47b2068SRick MacklemFor the example case, the commands on the MDS would be:
376d47b2068SRick Macklem.Bd -literal -offset
377d47b2068SRick Macklem# cd <top-level-exported-dir>
378d47b2068SRick Macklem# find . -type f -exec pnfsdscopymr -r /data3 {} \;
379d47b2068SRick Macklem.Ed
380d47b2068SRick Macklem.sp
381d47b2068SRick MacklemWhen this completes, the recovery should be complete or at least nearly so.
382d47b2068SRick MacklemAs noted above, if a link/unlink or rename occurs on a file name while the
383d47b2068SRick Macklemabove
384d47b2068SRick Macklem.Xr find 1
385d47b2068SRick Macklemis in progress, it may not get copied.
386d47b2068SRick MacklemTo check for any file(s) not yet copied, the commands are:
387d47b2068SRick Macklem.Bd -literal -offset
388d47b2068SRick Macklem# cd <top-level-exported-dir>
389d47b2068SRick Macklem# find . -type f -exec pnfsdsfile {} \; | sed "/0\.0\.0\.0/!d"
390d47b2068SRick Macklem.Ed
391d47b2068SRick Macklem.sp
392d47b2068SRick MacklemIf this command prints out any file name(s), these files must
393d47b2068SRick Macklemhave the
394d47b2068SRick Macklem.Xr pnfsdscopymr 8
395d47b2068SRick Macklemcommand done on them to complete the recovery.
396d47b2068SRick Macklem.Bd -literal -offset
397b8ac5c5aSRick Macklem# pnfsdscopymr -r /data3 <file-path-reported>
398d47b2068SRick Macklem.Ed
399d47b2068SRick Macklem.sp
400*a1697720SGordon BerglingIf this command fails with the error
401b8ac5c5aSRick Macklem.br
402b8ac5c5aSRick Macklem.Dq pnfsdscopymr: Copymr failed for file <path>: Device not configured
403b8ac5c5aSRick Macklem.br
404b8ac5c5aSRick Macklemrepeatedly, this may be caused by a Read/Write layout that has not
405b8ac5c5aSRick Macklembeen returned.
406b8ac5c5aSRick MacklemThe only way to get rid of such a layout is to restart the
407b8ac5c5aSRick Macklem.Xr nfsd 8 .
408b8ac5c5aSRick Macklem.sp
409d47b2068SRick MacklemAll of these commands are designed to be
410d47b2068SRick Macklemdone while the pNFS service is running and can be re-run safely.
411d47b2068SRick Macklem.Pp
412d47b2068SRick MacklemFor a more detailed discussion of the setup and management of a pNFS service
413d47b2068SRick Macklemsee:
414d47b2068SRick Macklem.Bd -literal -offset indent
415a0e33bbdSWolfram Schneiderhttps://people.freebsd.org/~rmacklem/pnfs-planb-setup.txt
416d47b2068SRick Macklem.Ed
417d47b2068SRick Macklem.sp
418d47b2068SRick Macklem.Sh SEE ALSO
419d47b2068SRick Macklem.Xr nfsv4 4 ,
420d47b2068SRick Macklem.Xr pnfs 4 ,
421d47b2068SRick Macklem.Xr exports 5 ,
422d47b2068SRick Macklem.Xr fstab 5 ,
423d47b2068SRick Macklem.Xr rc.conf 5 ,
424d47b2068SRick Macklem.Xr sysctl.conf 5 ,
425d47b2068SRick Macklem.Xr nfscbd 8 ,
426d47b2068SRick Macklem.Xr nfsd 8 ,
427d47b2068SRick Macklem.Xr nfsuserd 8 ,
428d47b2068SRick Macklem.Xr pnfsdscopymr 8 ,
429d47b2068SRick Macklem.Xr pnfsdsfile 8 ,
430d47b2068SRick Macklem.Xr pnfsdskill 8
431d47b2068SRick Macklem.Sh HISTORY
432d47b2068SRick MacklemThe
433d47b2068SRick Macklem.Nm
43494498988SRick Macklemservice first appeared in
435d47b2068SRick Macklem.Fx 12.0 .
436d47b2068SRick Macklem.Sh BUGS
437d47b2068SRick MacklemSince the MDS cannot be mirrored, it is a single point of failure just
438d47b2068SRick Macklemas a non
439d47b2068SRick Macklem.Tn pNFS
440d47b2068SRick Macklemserver is.
4414c87085dSGordon BerglingFor non-mirrored configurations, all
4424c87085dSGordon Bergling.Fx
4434c87085dSGordon Berglingsystems used in the service
444d47b2068SRick Macklemare single points of failure.
445