IBM Support

Examples of Using the SAV and RST Commands

Troubleshooting


Problem

This document gives some examples of using the SAV and RST commands to save and restore files or directories from the IFS on an IBM i.

Resolving The Problem

This document gives some examples of using the SAV and RST commands to save and restore files or directories from the IFS on a System i.

SAVES

Saving a specific file to a Stand-alone Tape drive

SAV DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir/myfile'))

Saving a directory to a Stand-alone Tape drive

SAV DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir'))
or
SAV DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir/*'))


Saving a specific file to a Tape Library

SAV DEV('/QSYS.LIB/TAPMLBxx.DEVD') OBJ(('/mydir/myfile')) VOL(XXXXXX)

Saving a directory to a Tape Library

SAV DEV('/QSYS.LIB/TAPMLBxx.DEVD') OBJ(('/mydir')) VOL(XXXXXX)
or
SAV DEV('/QSYS.LIB/TAPMLBxx.DEVD') OBJ(('/mydir/*')) VOL(XXXXXX)


Saving a specific file to a Save File

SAV DEV('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE') OBJ(('/mydir/myfile'))

Saving a directory to a Save File

SAV DEV('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE') OBJ(('/mydir'))

Saving a directory with an apostrophe to a stand-alone Tape Drive

SAV DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('"/mydir''s"'))

Saving a directory to a save file stored in an iASP library

SETASPGRP iASPname
SAV DEV('/IASPname/qsys.lib/library.lib/savf.file') OBJ(('/pathname/*'))

RESTORES
Restoring all IFS objects from tape on a stand-alone tape drive
RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/*') ('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT)) CRTPRNDIR(*YES)
Restoring all new IFS objects from tape that do not already exist on the system using a stand-alone tape drive
RST DEV('/qsys.lib/tap01.devd') OBJ(('/*') ('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT)) CRTPRNDIR(*YES) OPTION(*NEW)

Restoring a specific file on a Stand-alone Tape drive

RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir/myfile'))

Restoring a specific file to a different file on a Stand-alone Tape drive

RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir/myfile' *INCLUDE '/newdir/newfile'))

Restoring a directory from a Stand-alone Tape drive

RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir'))
or
RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir/*'))

Restoring a specific file to a different directory from a Stand-alone Tape drive

RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/mydir' *INCLUDE '/newdir'))

Note: At V5R4M0 and above, it is possible to automatically create the parent directory if it does not exist. Create parent directories . . . CRTPRNDIR > *YES


Restoring a specific file from a Tape Library

RST DEV('/QSYS.LIB/TAPMLBxx.DEVD') OBJ(('/mydir/myfile')) VOL(XXXXXX)

Restoring a directory from a Tape Library

RST DEV('/QSYS.LIB/TAPMLBxx.DEVD') OBJ(('/mydir')) VOL(XXXXXX)
or
RST DEV('/QSYS.LIB/TAPMLBxx.DEVD') OBJ(('/mydir/*')) VOL(XXXXXX)


Restoring a specific file from a Save File

RST DEV('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE') OBJ(('/mydir/myfile'))

Restoring a directory from a Save File

RST DEV('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE') OBJ(('/mydir'))

Restoring a directory with an apostrophe to a stand-alone Tape Drive

RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('"/mydir''s"'))

Restoring a directory from a Stand-alone Tape drive to an IASP that is mounted

RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/path_name' *INCLUDE '/IASPx/path_name')) ALWOBJDIF(*ALL)

Restoring a directory from a savf stored in an iASP library

SETASPGRP iASPname
RST DEV('/iASPname/qsys.lib/library.lib/savf.file') OBJ(('/pathname/*'))

Restoring an individual object into a UDFS, when UDFS or IASP was saved unmounted.
1. Check if UDFS is mounted:
DSPUDFS UDFS('/dev/IASPname/QDEFAULT.UDFS')
2. If UDFS is unmounted, mount it. For example:
MOUNT TYPE(*UDFS) MFS('/dev/IASPname/QDEFAULT.UDFS') MNTOVRDIR('/IASPname')
3. Restore object named "obj" using following command:
RST OBJ(('dev/IASPname/QDEFAULT.UDFS/obj' *INCLUDE '/IASPname/obj'))


Restoring a User Defined File System (UDFS) saved unmounted to an IASP from a Stand-alone Tape drive

1. Unmount any QDEFAULT user-defined file systems in the independent ASP.
Example: UNMOUNT TYPE(*UDFS) MNTOVRDIR('/IASPname2')

2. RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/dev/IASPname/QDEFAULT.UDFS' *INCLUDE '/dev/IASPname2/QDEFAULT.UDFS'))

3. Mount any QDEFAULT user-defined file systems that were unmounted in Step 1.
Example: MOUNT TYPE(*UDFS) MFS('/dev/IASPname2/QDEFAULT.UDFS') MNTOVRDIR('/IASPname2)

Notes:
1. If a *SYMLNK directory or object exists in the /path_name, this RST command may fail with message CPD379A. To restore the directory to the IASP, try one of the following:

a) Make sure that there is no '/path_name' of *SYMLNK existing.
b) Use this command instead: RST DEV('/QSYS.LIB/TAPxx.DEVD') OBJ(('/path_name/*' *INCLUDE '/IASPx/path_name/*')) ALWOBJDIF(*ALL).

2. If more room is needed on the OBJ or PATTERN parameters, type '&' on the parameter line needing more space and press Enter. This will make the line longer. This can be done multiple times until there is enough space to fit the entire path name.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]

Historical Number

500709056

Document Information

Modified date:
07 July 2020

UID

nas8N1013437