1.\" Copyright (c) 2018 Rick Macklem
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice, this list of conditions and the following disclaimer.
8.\" 2. Redistributions in binary form must reproduce the above copyright
9.\"    notice, this list of conditions and the following disclaimer in the
10.\"    documentation and/or other materials provided with the distribution.
11.\"
12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22.\" SUCH DAMAGE.
23.\"
24.\" $FreeBSD$
25.\"
26.Dd June 2, 2018
27.Dt PNFSDSCOPYMR 8
28.Os
29.Sh NAME
30.Nm pnfsdscopymr
31.Nd
32copy or move a data storage file for a MDS file to a different DS
33.Sh SYNOPSIS
34.Nm
35.Op Fl r Ar mounted-on-DS-dir
36.Op Fl m Ar source-mounted-on-DS-dir destination-mounted-on-DS-dir
37.Ar mdsfile
38.Sh DESCRIPTION
39The
40.Nm
41command copies a data storage file for an MDS file from one DS to another DS.
42It is normally used to recover data files onto a repaired DS, but can also
43be used to manually migrate a data storage file from one DS to a different one.
44By default, the command will copy the data storage file for
45.Dq mdsfile
46to one of the other DSs to create a mirror of it.
47This might be done if the file was created before mirroring was enabled on
48the pNFS service and now needs to be mirrored.
49.Pp
50The following options are available:
51.Bl -tag -width Ds
52.It Fl r Ar mounted-on-DS-dir
53This option indicates that the data storage file should be created on the DS
54that is mounted on the directory
55.Dq mounted-on-DS-dir .
56It will only do the copy if there is an entry in the pnfsd.dsfile extended
57attribute that has an IP address of 0.0.0.0.
58See
59.Xr pnfsdsfile 1
60for how to do this.
61This is normally done for all regular files via
62.Xr find 1
63in order to recover the data
64storage files onto a repaired DS.
65.It Fl m Ar source-mounted-on-DS-dir destination-mounted-on-DS-dir
66This option indicates that the data storage file is to be migrated from
67the source DS mounted on the diectory
68.Dq source-mounted-on-DS-dir
69to the DS mounted on the directory
70.Dq destination-mounted-on-DS-dir .
71In this case, the data storage file will be removed from the source DS
72when the copy is completed.
73.El
74If the copy/migration is already done, the command will simply exit(0),
75so that it can safely be used on all regular files in the exported directory
76tree on the MDS.
77.Pp
78This command must be run on the MDS and a typical usage would be as an
79argument for
80.Xr find 1
81for all regular files.
82.sp
83For example, if the repaired DS is mounted on /data3 and files previously
84stored on the repaired DS have had the DS's IP address set to 0.0.0.0:
85.br
86# cd <top-level-exported-directory-on-the-MDS>
87.br
88# find . -type f -exec pnfsdscopymr -r /data3 {} \\;
89.Sh SEE ALSO
90.Xr find 1 ,
91.Xr nfsv4 4 ,
92.Xr pnfs 4 ,
93.Xr nfsd 8 ,
94.Xr pnfsdsfile 8 ,
95.Xr pnfsdskill 8
96.Sh HISTORY
97The
98.Nm
99command first appeared in
100.Fx 12.0 .
101