ERMT(1)
π¦ ermt(1) β remote magtape protocol module (with transparent encryption, bestie!!) π
okay so real quick before we dive in: this is a System management commands page, section 1, and the star of the show is ermt. she's iconic, she's niche, let's go β¨
πΈ NAME πΈ
ermt β remote magtape protocol module, but make it πencryptedπ. like, it has transparent encryption support, no cap.
β¨ SYNOPSIS β¨
ermt
yes bestie that's it. that's the whole synopsis. she takes zero arguments here π
π DESCRIPTION π
okay so Ermt is a program that the remote dump(8), restore(8), cpio(1) or tar(1) programs use to manipulate a magnetic tape drive through an interprocess communication connection. Ermt is normally started up with an ssh(1), rexec(3) or rcmd(3) call. so you're not running it yourself, you're the transport layer π«
The ermt program accepts requests specific to the manipulation of magnetic tapes, performs the commands, then responds with a status indication. All responses are in ASCII and in one of the following two forms.
Successful commands have responses of:
Anumber\n
where number is an ASCII representation of a decimal number.
Unsuccessful commands are responded to with:
Eerror-number\nerror-message\n
where error-number is one of the possible error numbers described in intro(2) and error-message is the corresponding error string as printed from a call to perror(3).
The protocol is comprised of the following commands, which are sent as indicated β no spaces are supplied between the command and its arguments, or between its arguments, and \n indicates that a newline should be supplied:
Odevice\nmode\nβ Open the specified device using the indicated mode. Device is a full pathname and mode is an ASCII representation of a decimal number suitable for passing toopen(2). If a device had already been opened, it is closed before a new open is performed.Cdevice\nβ Close the currently open device. The device specified is ignored.Lwhence\noffset\nβ Perform anlseek(2)operation using the specified parameters. The response value is that returned from thelseekcall.Wcount\nβ Write data onto the open device.Rmtreads count bytes from the connection, aborting if a premature end-of-file is encountered. The response value is that returned from thewrite(2)call.Rcount\nβ Read count bytes of data from the open device. If count exceeds the size of the data buffer (10 kilobytes), it is truncated to the data buffer size.Rmtthen performs the requestedread(2)and responds withAcount-read\nif the read was successful; otherwise an error in the standard format is returned. If the read was successful, the data read is then sent.Ioperation\ncount\nβ Perform aMTIOCOPioctl(2)command using the specified parameters. The parameters are interpreted as the ASCII representations of the decimal values to place in themt_opandmt_countfields of the structure used in theioctlcall. The return value is the count parameter when the operation is successful.
By issuing the I-1\n0\n command, a client will specify that he is using the VERSION 1 protocol.
For a VERSION 0 client, the operation parameter is the platform mt_op value (could be different if the client and the rmt server are on two different platforms). For a VERSION 1 client, the operation parameter is standardized as below:
0β Issue aMTWEOFcommand (write count end-of-file records).1β Issue aMTFSFcommand (forward space over count file marks).2β Issue aMTBSFcommand (backward space over count file marks).3β Issue aMTFSRcommand (forward space count inter-record gaps).4β Issue aMTBSRcommand (backward space count inter-record gaps).5β Issue aMTREWcommand (rewind).6β Issue aMTOFFLcommand (rewind and put the drive offline).7β Issue aMTNOPcommand (no operation, set status only).
ioperation\ncount\nβ Perform an extendedMTIOCOPioctl(2)command using the specified parameters. The parameters are interpreted as the ASCII representations of the decimal values to place in themt_opandmt_countfields of the structure used in theioctlcall. The return value is the count parameter when the operation is successful. The possible operations are:0β Issue aMTCACHEcommand (switch cache on).1β Issue aMTNOCACHEcommand (switch cache off).2β Issue aMTRETENcommand (retension the tape).3β Issue aMTERASEcommand (erase the entire tape).4β Issue aMTEOMcommand (position to end of media).5β Issue aMTNBSFcommand (backward space count files to BOF).
Sβ Return the status of the open device, as obtained with aMTIOCGETioctlcall. If the operation was successful, an βackβ is sent with the size of the status buffer, then the status buffer is sent (in binary, which is non-portable between different platforms π).ssub-commandβ This is a replacement for the previousScommand, portable across different platforms. If the open device is a magnetic tape, return members of the magnetic tape status structure, as obtained with aMTIOCGETioctlcall. If the open device is not a magnetic tape, an error is returned. If theMTIOCGEToperation was successful, the numerical value of the structure member is returned in decimal. The following sub commands are supported:Tβ return the content of the structure membermt_typewhich contains the type of the magnetic tape device.Dβ return the content of the structure membermt_dsregwhich contains the "drive status register".Eβ return the content of the structure membermt_erregwhich contains the "error register". This structure member must be retrieved first because it is cleared after eachMTIOCGETioctlcall. β οΈRβ return the content of the structure membermt_residwhich contains the residual count of the last I/O.Fβ return the content of the structure membermt_filenowhich contains the file number of the current tape position.Bβ return the content of the structure membermt_blknowhich contains the block number of the current tape position.fβ return the content of the structure membermt_flagswhich containsMTF_flags from the driver.bβ return the content of the structure membermt_bfwhich contains the optimum blocking factor.
π Any other command causes rmt to exit. that's it. that's the whole vibe check. fail it and you're gone, bestie.
π ENCRYPTION π
This version of the "rmt" utility β ermt β have a transparent encryption support. Data is encrypted before it is written to tape, and decrypted when read. and tar) can manipulate encrypted data without modification.
(^ that last line is a little glitched in the original, but the point stands: the encryption is transparent, the tools on either end just see data π«Ά)
ermt reads the secret key from .ermt.key and use openssl(1) for perform encryption and decryption. The symmetric cipher is currently hardwired as Blowfish. periodt. π‘
π EXAMPLES π
π§ Run-time setup:
- Create a user for remote tape access, which we will call "dump":
useradd -m dump
- Generate a random key in
~dump/.ermt.key:
su - dump
openssl rand -out .ermt.key 32
chmod 400 .ermt.key
β οΈ Due to the way"openssl enc -kfile .ermt.key"reads the key file, you should ensure that the key contains no\0or\ror\ncharacters, which would prematurely truncate the key length. ngl this one matters, don't skip it π
- Protect the key: copy to many floppies,
"od -x .ermt.key|lpr", etc. yes, floppies. she's vintage πΎβ¨ - Set up
sshaccess fromroot(or whoever you rundumpas) - Copy the
ermtbinary to~dumpand change dump's shell to~dump/ermt
or
- If user who run backup program is a same with the user who must to run
rmt, just installermtbinary into a bin folder.
π Backup usage:
Just dump remotely to localhost:
dump -0u -f dump@localhost:/dev/st0 /
restore -i -f dump@localhost:/dev/st0
# You can use GNU tar too
If your device is doing hardware compression, it's best to turn it off, since encrypted data compresses very poorly. π₯ (sorry, entropy is like that)
π Emergency decrypting:
If you need to restore a tape and don't have access to a host running ermt, you have two choices:
- If you have a copy of the
ermtbinary, run it with the-dswitch to decrypt stdin to stdout:
dd if=/dev/st0 bs=10k |
(cd ~dump; ./ermt -d) | # assuming ermt is in ~dump
restore -i -f -
- If not, use the OpenSSL "openssl" command, which does the same thing:
dd if=/dev/st0 bs=10k |
openssl enc -d -kfile ~dump/.ermt.key -blowfish -nosalt -nopad |
restore -i -f -
π ERRORS π
If "~/.ermt.key" will not be found, any opertion will fail. like, all of them. every single one. so maybe make sure the key is there, bestie π
β DIAGNOSTICS β
All responses are of the form described above. (scroll up, it's the Anumber\n / Eerror-number\nerror-message\n situation π
)
π SEE ALSO π
ssh(1), rcmd(3), rexec(3), /usr/include/sys/mtio.h, dump(8), restore(8)
π BUGS π
People should be discouraged from using this for a remote file access protocol. that's it. that's the bug note. she said what she said π«Ά
π¦ AUTHOR π¦
The dump/restore backup suit was ported to Linux's Second Extended File System by Remy Card <card@Linux.EU.Org>. He maintained the initial versions of dump (up and including 0.4b4, released in january 1997).
Starting with 0.4b5, the new maintainer is Stelian Pop <stelian@popies.net>.
π AVAILABILITY π
The dump/restore backup suit is available from <http://dump.sourceforge.net>
π HISTORY π
The rmt command appeared in 4.2BSD.
β¨ and that's the whole page, bestie β¨ this one's from the BSD fam, version 0.4b49 of 30 Nov 2024, and honestly? she ate. mwah πππ
π¦ where this page comes from
- opensuse-leap 16.0: dump-rmt 0.4b49-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: dump-rmt 0.4b49-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: dump-rmt 0.4b49-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: dump-rmt 0.4b49-160000.2.2 Β· BSD-3-Clause
- Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms