File Transfer to and from Guest Operating System
This section provides some examples of how to transfer data to/from the guest operating system. These examples are intended for illustrative purposes only. The actual file transfer (especially in the context of a migration from physical to emulated hardware) depends on the exact customer environment and requirements.
Transferring Files to/from an HP-UX Guest
HP-UX offers various commands and methods to copy files between the guest system and other systems.
Examples:
Copying data using physical media, e.g., a tape drive, to transfer data between HP-UX running on Charon-PAR and another HP-UX system.
NFS: the HP-UX can mount a remote filesystem or a remote system can mount a filesystem exported by the guest HP-UX. Then data can be exchanged between the two systems.
File transfer programs, e.g., sftp and scp.
General backup and recovery programs in conjunction with a file transfer program, e.g., tar, cpio, pax, fbackup/frecover.
The following section will provide some examples. Please refer to your system's documentation for additional information and methods not covered in the examples.
Please note:
When using SSH-based applications (ssh, scp, sftp) for connecting to a HP-UX system from a modern Linux system, you may run into a problem caused by a mismatch of available key exchange methods. The error shown will be similar to the sample below:
Unable to negotiate with 192.168.2.87 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
In such cases, you can use the following workaround:
Add the SSH option -oKexAlgorithms=+diffie-hellman-group1-sha1 to your command.
Transferring Files with SCP
With SCP, single files or directory structures (recursive copy) can be copied to and from HP-UX.
The following table shows some SCP syntax examples
Task | Command |
|---|---|
Copy single file to another system | $ |
Copy a directory recursively to another system | $ |
Copy a single file from another system | $ |
Copy a directory recursively from another system | $ |
The following example shows how a small directory tree is copied to a user account named charon from another system:
Transferring Files with SFTP
SFTP is another file transfer program that can be used for secure file transfers between the HP-UX guest system and other systems. The SFTP program can be used interactively (similarly to FTP) and in non-interactive mode. When used in interactive mode, you can use the help command to learn about the command syntax. SFTP can resume interrupted file transfers.
The following example shows how a directory structure is recursively copied from the guest system (IP address 192.168.2.107 in the example) by another system:
Using General Backup and Restore Commands
When transferring larger amounts of data (e.g., when moving application data from one HP-UX system to another), it is more efficient create an archive of the required data before transferring them and unpacking the data on the target system.
HP-UX offers a large number of such programs. For example:
cpio
tar
dump/restore for HFS filesystems
vxdump/vxrestore for VxFS filesystems
fbackup/frecover for selective file backup and restore
make_net_recovery / make_tape_recovery when working with Ignite
pax to create and restore archive files of different formats; there is also an pax_enh package to support file sizes larger than 8GB in version 11.23 (default in HP-UX 11.31).
Please note:
The cpio and the standard tar command on HP-UX have restrictions with respect to the largest file size they can handle: the maximum file size for cpio is 2GB, the maximum for tar is 8GB.
The utilities tar, cpio, and pax can be used to transfer archives between HP-UX and other operating systems.
When creating an archive using one of the above commands, you can copy the archive to the target HP-UX system and restore it there. Alternatively, you can pipe the archive command on the source system through ssh to the respective restore command on the target.
The following example shows how to use fbackup/frecover through ssh to copy files between two HP-UX systems:
On the source system:
|
The following example shows how to use pax through ssh to copy files between two HP-UX systems or between an HP-UX system and, for example, a Linux system:
On the source system:
|