The mirrorvg Command
The mirrorvg command takes all the logical volumes on a given volume group and mirrors those logical volumes. This same functionality may also be accomplished manually if you execute the mklvcopy command for each individual logical volume in a volume group. As with mklvcopy, the target physical drives to be mirrored with data must already be members of the volume group. To add disks to a volume group, run the extendvg command.
By default, mirrorvg attempts to mirror the logical volumes onto any of the disks in a volume group. If you wish to control which drives are used for mirroring, you must include the list of disks in the input parameters, physicalvolume. Mirror strictness is enforced. Additionally, mirrorvg mirrors the logical volumes, using the default settings of the logical volume being mirrored. If you wish to violate mirror strictness or affect the policy by which the mirror is created, you must execute the mirroring of all logical volumes manually with the mklvcopy command.
When mirrorvg is executed, the default behavior of the command requires that the synchronization of the mirrors must complete before the command returns to the user. If you wish to avoid the delay, use the -S or -s option. Additionally, the default value of 2 copies is always used. To specify a value other than 2, use the -c option.
Offsite Data Protection
Off-site data protection, or vaulting, is the strategy of sending critical data out of the main location (off the main site) as part of a disaster recovery plan. Data is usually transported off-site using removable storage media such as magnetic tape or optical storage. Data can also be sent electronically via a remote backup service, which is known as electronic vaulting or e-vaulting. Sending backups off-site ensures systems and servers can be reloaded with the latest data in the event of a disaster, accidental error, or system crash. Sending backups off-site also ensures that there is a copy of pertinent data that isn’t stored on-site.
Although some organizations manage and store their own off-site backups, many choose to have their backups managed and stored by third parties who specialize in the commercial protection of off-site data.
The scp Command
The scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. The SCP command or secure copy allows secure transferring of files in between the local host and the remote host or between two remote hosts. It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol. SCP is known for its simplicity, security and pre-installed availability.
scp [ OPTIONS }
|–P port||Specifies the port to connect on the remote host.|
|–p||Preserves modification times, access times, and modes from the original file.|
|–q||Disables the progress meter.|
|–r||Recursively copies entire directories.|
|–S program||Name of program to use for the encrypted connection. The program must understand ssh(1) options.|
|–v||Verbose mode. Causes scp and ssh to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.|
The use of scp is pretty simple.
- Select another cipher as to encrypt files: By default, scp is using the “AES-128” to encrypt files. If you want to change to any another cipher to encrypt it, you can do that by using “-c” parameter.
pbmac@pbmac-server $ scp -c 3des-cbc myFile.ppdf email@example.com:/PDF
- To specify a specific port to use with scp: Usually, scp is using port 22 as a default port. But for security reasons, you can change the port into another port. For example, we are going to use port 2249. Then the command needs to be like this.
pbmac@pbmac-server $ scp -P 2249 Label.pdf firstname.lastname@example.org:.
The sftp Command
The SSH File Transfer Protocol (also Secure File Transfer Protocol, or SFTP) is a network protocol that provides file access, file transfer, and file management over any reliable data stream. It was designed by the Internet Engineering Task Force (IETF) as an extension of the Secure Shell protocol (SSH) version 2.0 to provide secure file transfer capabilities. The IETF Internet Draft states that, even though this protocol is described in the context of the SSH-2 protocol, it could be used in a number of different applications, such as secure file transfer over Transport Layer Security (TLS) and transfer of management information in VPN applications.
This protocol assumes that it is run over a secure channel, such as SSH, that the server has already authenticated the client, and that the identity of the client user is available to the protocol.
If it is possible to connect to a remote system using SSH, then it will be possible to use SFTP to manage files. Test SSH access with the following command:
pbmac@pbmac-server $ ssh email@example.com
You should use a valid userid and a valid hostname, NOT the credentials in the above example. If that works, exit back out by typing:
Now use the sftp command to access the remote system and transfer files:
pbmac@pbmac-server $ sftp firstname.lastname@example.org:pdfFiles/Resume.pdf
When you run this command, sftp will connect to pbmac-server.com, ask you for your password, and once you're authenticated it will attempt to download the file pdfFiles/Resume.pdf. Since we didn't put a slash at the beginning of the directory name, it will look for pdfFiles in the user's home directory on the server. If it finds Resume.pdf, it will download it.
The output will look like this:
Fetching /home/pbmac/pdfFiles/Resume.pdf to Resume.pdf
...and then sftp will exit. You can also specify a location for the file to be downloaded.
It is possible to save the downloaded file to a different location. In the following example it downloads the Resume.pdf file to the user's tmp folder
pbmac@pbmac-server $ sftp email@example.com:pdfFiles/Resume.pdf tmp/Resume.pdf
...and the output will indicate the new filename:
Fetching /home/pbmac/pdfFiles/Resume.pdf to tmp/Resume.pdf
The rsync Command
The rsync utility efficiently transfers and synchronizes files between a computer and an external hard drive and across networked computers by comparing the modification times and sizes of files. It is commonly found on Unix-like operating systems. rsync is written in C as a single threaded application. The rsync algorithm is a type of delta encoding, and is used for minimizing network usage. Zlib may be used for additional data compression, and SSH or stunnel can be used for security. rsync is the facility typically used for synchronizing software repositories on mirror sites used by package management systems.
rsync is typically used for synchronizing files and directories between two different systems. For example, if the command rsync local-file user@remote-host:remote-file is run, rsync will use SSH to connect as user to remote-host. Once connected, it will invoke the remote host's rsync and then the two programs will determine what parts of the local file need to be transferred so that the remote file matches the local one.
"scp command in Linux with Examples" by rahulkumarmandal, Geeks for Geeks is licensed under CC BY-SA 4.0
"SSH File Transfer Protocol" by Multiuple Contributors, Wikipedia is licensed under CC BY-SA 3.0
"rsync" by Multiuple Contributors, Wikipedia is licensed under CC BY-SA 3.0