| 1 |
.\" Copyright (c) 1983, 1991, 1993 |
| 2 |
.\" The Regents of the University of California. All rights reserved. |
| 3 |
.\" |
| 4 |
.\" Redistribution and use in source and binary forms, with or without |
| 5 |
.\" modification, are permitted provided that the following conditions |
| 6 |
.\" are met: |
| 7 |
.\" 1. Redistributions of source code must retain the above copyright |
| 8 |
.\" notice, this list of conditions and the following disclaimer. |
| 9 |
.\" 2. Redistributions in binary form must reproduce the above copyright |
| 10 |
.\" notice, this list of conditions and the following disclaimer in the |
| 11 |
.\" documentation and/or other materials provided with the distribution. |
| 12 |
.\" 3. Neither the name of the University nor the names of its contributors |
| 13 |
.\" may be used to endorse or promote products derived from this software |
| 14 |
.\" without specific prior written permission. |
| 15 |
.\" |
| 16 |
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 17 |
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 |
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 20 |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 21 |
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 22 |
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 23 |
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 24 |
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 25 |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 |
.\" SUCH DAMAGE. |
| 27 |
.\" |
| 28 |
.TH RMT 8 "version __VERSION__ of __DATE__" BSD "System management commands" |
| 29 |
.SH NAME |
| 30 |
rmt \- remote magtape protocol module |
| 31 |
.SH SYNOPSIS |
| 32 |
.B rmt |
| 33 |
.SH DESCRIPTION |
| 34 |
.B Rmt |
| 35 |
is a program used by the remote |
| 36 |
.BR dump (8), |
| 37 |
.BR restore (8) |
| 38 |
or |
| 39 |
.BR tar (1) |
| 40 |
programs in manipulating a magnetic tape drive through an interprocess |
| 41 |
communication connection. |
| 42 |
.B Rmt |
| 43 |
is normally started up with an |
| 44 |
.BR rexec (3) |
| 45 |
or |
| 46 |
.BR rcmd (3) |
| 47 |
call. |
| 48 |
.PP |
| 49 |
The |
| 50 |
.B rmt |
| 51 |
program accepts requests specific to the manipulation of magnetic tapes, |
| 52 |
performs the commands, then responds with a status indication. All responses |
| 53 |
are in |
| 54 |
.B ASCII |
| 55 |
and in one of the following two forms. |
| 56 |
.PP |
| 57 |
Successful commands have responses of: |
| 58 |
.RS |
| 59 |
.B A\fInumber\fR\en |
| 60 |
.RE |
| 61 |
.PP |
| 62 |
where |
| 63 |
.I number |
| 64 |
is an |
| 65 |
.B ASCII |
| 66 |
representation of a decimal number. |
| 67 |
.PP |
| 68 |
Unsuccessful commands are responded to with: |
| 69 |
.RS |
| 70 |
.B E\fIerror-number\fR\en\fIerror-message\fR\en |
| 71 |
.RE |
| 72 |
.PP |
| 73 |
where |
| 74 |
.I error-number |
| 75 |
is one of the possible error numbers described in |
| 76 |
.BR intro (2) |
| 77 |
and |
| 78 |
.I error-message |
| 79 |
is the corresponding error string as printed from a call to |
| 80 |
.BR perror (3). |
| 81 |
.PP |
| 82 |
The protocol is comprised of the following commands, which are sent as |
| 83 |
indicated - no spaces are supplied between the command and its arguments, or |
| 84 |
between its arguments, and \en indicates that a newline should be supplied: |
| 85 |
.TP |
| 86 |
.B O\fIdevice\fR\en\fImode\fR\en |
| 87 |
Open the specified |
| 88 |
.I device |
| 89 |
using the indicated |
| 90 |
.IR mode . |
| 91 |
.I Device |
| 92 |
is a full pathname and |
| 93 |
.I mode |
| 94 |
is an |
| 95 |
.B ASCII |
| 96 |
representation of a decimal number suitable for passing to |
| 97 |
.BR open (2). |
| 98 |
If a device had already been opened, it is closed before a new open is |
| 99 |
performed. |
| 100 |
.TP |
| 101 |
.B C\fIdevice\fR\en |
| 102 |
Close the currently open device. The |
| 103 |
.I device |
| 104 |
specified is ignored. |
| 105 |
.TP |
| 106 |
.B L\fIwhence\fR\en\fIoffset\fR\en |
| 107 |
Perform an |
| 108 |
.BR lseek (2) |
| 109 |
operation using the specified parameters. The response value is that returned |
| 110 |
from the |
| 111 |
.B lseek |
| 112 |
call. |
| 113 |
.TP |
| 114 |
.B W\fIcount\fR\en |
| 115 |
Write data onto the open device. |
| 116 |
.B Rmt |
| 117 |
reads |
| 118 |
.I count |
| 119 |
bytes from the connection, aborting if a premature end-of-file is encountered. |
| 120 |
The response value is that returned from the |
| 121 |
.BR write (2) |
| 122 |
call. |
| 123 |
.TP |
| 124 |
.B R\fIcount\fR\en |
| 125 |
Read |
| 126 |
.I count |
| 127 |
bytes of data from the open device. If |
| 128 |
.I count |
| 129 |
exceeds the size of the data buffer (10 kilobytes), it is truncated to the |
| 130 |
data buffer size. |
| 131 |
.B Rmt |
| 132 |
then performs the requested |
| 133 |
.BR read (2) |
| 134 |
and responds with |
| 135 |
.B A\fIcount-read\fR\en |
| 136 |
if the read was successful; otherwise an error in the standard format is |
| 137 |
returned. If the read was successful, the data read is then sent. |
| 138 |
.TP |
| 139 |
.B I\fIoperation\fR\en\fIcount\fR\en |
| 140 |
Perform a |
| 141 |
.B MTIOCOP |
| 142 |
.BR ioctl (2) |
| 143 |
command using the specified parameters. The parameters are interpreted as the |
| 144 |
.B ASCII |
| 145 |
representations of the decimal values to place in the |
| 146 |
.B mt_op |
| 147 |
and |
| 148 |
.B mt_count |
| 149 |
fields of the structure used in the |
| 150 |
.B ioctl |
| 151 |
call. The return value is the |
| 152 |
.I count |
| 153 |
parameter when the operation is successful. |
| 154 |
.IP |
| 155 |
By issuing the |
| 156 |
.B I-1\en0\en |
| 157 |
command, a client will specify that he is using the VERSION 1 protocol. |
| 158 |
.IP |
| 159 |
For a VERSION 0 client, the |
| 160 |
.I operation |
| 161 |
parameter is the platform |
| 162 |
.B mt_op |
| 163 |
value (could be different if the client and the |
| 164 |
.B rmt |
| 165 |
server are on two different platforms). For a VERSION 1 client, the |
| 166 |
.I operation |
| 167 |
parameter is standardized as below: |
| 168 |
.RS |
| 169 |
.TP |
| 170 |
.B 0 |
| 171 |
Issue a |
| 172 |
.B MTWEOF |
| 173 |
command (write |
| 174 |
.I count |
| 175 |
end-of-file records). |
| 176 |
.TP |
| 177 |
.B 1 |
| 178 |
Issue a |
| 179 |
.B MTFSF |
| 180 |
command (forward space over |
| 181 |
.I count |
| 182 |
file marks). |
| 183 |
.TP |
| 184 |
.B 2 |
| 185 |
Issue a |
| 186 |
.B MTBSF |
| 187 |
command (backward space over |
| 188 |
.I count |
| 189 |
file marks). |
| 190 |
.TP |
| 191 |
.B 3 |
| 192 |
Issue a |
| 193 |
.B MTFSR |
| 194 |
command (forward space |
| 195 |
.I count |
| 196 |
inter-record gaps). |
| 197 |
.TP |
| 198 |
.B 4 |
| 199 |
Issue a |
| 200 |
.B MTBSR |
| 201 |
command (backward space |
| 202 |
.I count |
| 203 |
inter-record gaps). |
| 204 |
.TP |
| 205 |
.B 5 |
| 206 |
Issue a |
| 207 |
.B MTREW |
| 208 |
command (rewind). |
| 209 |
.TP |
| 210 |
.B 6 |
| 211 |
Issue a |
| 212 |
.B MTOFFL |
| 213 |
command (rewind and put the drive offline). |
| 214 |
.TP |
| 215 |
.B 7 |
| 216 |
Issue a |
| 217 |
.B MTNOP |
| 218 |
command (no operation, set status only). |
| 219 |
.RE |
| 220 |
.TP |
| 221 |
.B i\fIoperation\fR\en\fIcount\fR\en |
| 222 |
Perform an extended |
| 223 |
.B MTIOCOP |
| 224 |
.BR ioctl (2) |
| 225 |
command using the specified parameters. The parameters are interpreted as the |
| 226 |
.B ASCII |
| 227 |
representations of the decimal values to place in the |
| 228 |
.B mt_op |
| 229 |
and |
| 230 |
.B mt_count |
| 231 |
fields of the structure used in the |
| 232 |
.B ioctl |
| 233 |
call. The return value is the |
| 234 |
.I count |
| 235 |
parameter when the operation is successful. The possible operations are: |
| 236 |
.RS |
| 237 |
.TP |
| 238 |
.B 0 |
| 239 |
Issue a |
| 240 |
.B MTCACHE |
| 241 |
command (switch cache on). |
| 242 |
.TP |
| 243 |
.B 1 |
| 244 |
Issue a |
| 245 |
.B MTNOCACHE |
| 246 |
command (switch cache off). |
| 247 |
.TP |
| 248 |
.B 2 |
| 249 |
Issue a |
| 250 |
.B MTRETEN |
| 251 |
command (retension the tape). |
| 252 |
.TP |
| 253 |
.B 3 |
| 254 |
Issue a |
| 255 |
.B MTERASE |
| 256 |
command (erase the entire tape). |
| 257 |
.TP |
| 258 |
.B 4 |
| 259 |
Issue a |
| 260 |
.B MTEOM |
| 261 |
command (position to end of media). |
| 262 |
.TP |
| 263 |
.B 5 |
| 264 |
Issue a |
| 265 |
.B MTNBSF |
| 266 |
command (backward space count files to BOF). |
| 267 |
.RE |
| 268 |
.TP |
| 269 |
.B S |
| 270 |
Return the status of the open device, as obtained with a |
| 271 |
.B MTIOCGET |
| 272 |
.B ioctl |
| 273 |
call. If the operation was successful, an \*(lqack\*(rq is sent with the size |
| 274 |
of the status buffer, then the status buffer is sent (in binary, which is |
| 275 |
non-portable between different platforms). |
| 276 |
.TP |
| 277 |
.BI s sub-command |
| 278 |
This is a replacement for the previous |
| 279 |
.B S |
| 280 |
command, portable across different platforms. If the open device is a magnetic |
| 281 |
tape, return members of the magnetic tape status structure, as obtained with a |
| 282 |
.B MTIOCGET |
| 283 |
ioctl call. If the open device is not a magnetic tape, an error is returned. If |
| 284 |
the |
| 285 |
.B MTIOCGET |
| 286 |
operation was successful, the numerical value of the structure member is |
| 287 |
returned in decimal. The following sub commands are supported: |
| 288 |
.RS |
| 289 |
.TP |
| 290 |
.B T |
| 291 |
return the content of the structure member |
| 292 |
.B mt_type |
| 293 |
which contains the type of the magnetic tape device. |
| 294 |
.TP |
| 295 |
.B D |
| 296 |
return the content of the structure member |
| 297 |
.B mt_dsreg |
| 298 |
which contains the "drive status register". |
| 299 |
.TP |
| 300 |
.B E |
| 301 |
return the content of the structure member |
| 302 |
.B mt_erreg |
| 303 |
which contains the "error register". This structure member must be retrieved |
| 304 |
first because it is cleared after each |
| 305 |
.B MTIOCGET |
| 306 |
ioctl call. |
| 307 |
.TP |
| 308 |
.B R |
| 309 |
return the content of the structure member |
| 310 |
.B mt_resid |
| 311 |
which contains the residual count of the last I/O. |
| 312 |
.TP |
| 313 |
.B F |
| 314 |
return the content of the structure member |
| 315 |
.B mt_fileno |
| 316 |
which contains the file number of the current tape position. |
| 317 |
.TP |
| 318 |
.B B |
| 319 |
return the content of the structure member |
| 320 |
.B mt_blkno |
| 321 |
which contains the block number of the current tape position. |
| 322 |
.TP |
| 323 |
.B f |
| 324 |
return the content of the structure member |
| 325 |
.B mt_flags |
| 326 |
which contains MTF_ flags from the driver. |
| 327 |
.TP |
| 328 |
.B b |
| 329 |
return the content of the structure member |
| 330 |
.B mt_bf |
| 331 |
which contains the optimum blocking factor. |
| 332 |
.RE |
| 333 |
.PP |
| 334 |
Any other command causes |
| 335 |
.B rmt |
| 336 |
to exit. |
| 337 |
.SH DIAGNOSTICS |
| 338 |
All responses are of the form described above. |
| 339 |
.SH SEE ALSO |
| 340 |
.BR rcmd (3), |
| 341 |
.BR rexec (3), |
| 342 |
.I /usr/include/sys/mtio.h, |
| 343 |
.BR rdump (8), |
| 344 |
.BR rrestore (8) |
| 345 |
.SH BUGS |
| 346 |
People should be discouraged from using this for a remote file access protocol. |
| 347 |
.SH AUTHOR |
| 348 |
The |
| 349 |
.B dump/restore |
| 350 |
backup suit was ported to Linux's Second Extended File System by Remy Card |
| 351 |
<[email protected]>. He maintained the initial versions of |
| 352 |
.B dump |
| 353 |
(up and including 0.4b4, released in january 1997). |
| 354 |
.PP |
| 355 |
Starting with 0.4b5, the new maintainer is Stelian Pop <[email protected]>. |
| 356 |
.SH AVAILABILITY |
| 357 |
The |
| 358 |
.B dump/restore |
| 359 |
backup suit is available from <https://dump.sourceforge.io> |
| 360 |
.SH HISTORY |
| 361 |
The |
| 362 |
.B rmt |
| 363 |
command appeared in 4.2BSD. |