Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sec2prim(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fsck, dfsck

rdevcvt

store

chfstore

File System Backup

fs

inode



SEC2PRIM(1,C)               AIX Commands Reference                SEC2PRIM(1,C)



-------------------------------------------------------------------------------
sec2prim



PURPOSE

Converts a secondary or backbone copy of a replicated system into a primary
copy of a replicated system.

SYNTAX


            +--------+
sec2prim ---| +----+ |--- device ---|
            +-| -a |-+
             ^| -u ||
             |+----+|
             +------+


Warning: See restrictions, Chapter 18, AIX Programming Tools and Interfaces.

DESCRIPTION

The sec2prim program converts a secondary or backbone copy of a replicated file
system into a primary copy of a replicated file system.

A secondary copy of a replicated file system need not store a copy of every
file in the primary file system.  Typically the secondary copies of a
replicated file system as stored on a 386 site, will only include files that
are pertinent to 386 operation, and will exclude 370 files.  The directory
entries in the secondary file system contain the inode numbers for files which
are not stored in the secondary file system.  The inodes will indicate that the
file is stored locally.  The sec2prim program removes directory entries which
point to inodes of files that are not stored in the secondary file system.
After all the directories have been updated, the free inode list and the
committed transaction list will be rebuilt.  The file system has now become the
primary copy of a replicated file system.

The sec2prim program parses the command line arguments, sets the appropriate
switch values, and maintains a pointer to the device name to use.  If an
invalid switch is specified or a device is not specified, sec2prim generates
the usage message.

The sec2prim program allocates memory for I/O buffers and creates pointer to
buffers guaranteeing that the buffers are allocated on 4K boundaries.

Each disk device has both a block and raw device name.  If the file system
stored on the device is mounted, sec2prim uses the block device name.
Otherwise the raw device name is used.




Processed November 8, 1990       SEC2PRIM(1,C)                                1





SEC2PRIM(1,C)               AIX Commands Reference                SEC2PRIM(1,C)



The sec2prim program opens the device and verifies that the device contains a
secondary or backbone copy of a replicated file system.  If an invalid device
or file system is specified, sec2prim displays an error message and aborts the
program.

If file replication updates are pending, sec2prim generates a warning to the
user and asks if the program should continue.

The sec2prim program first reads each inode in the file system and stores a
code indicating the status of each inode.  The status codes are:

           IS_NOTSTO       Not Stored
           IS_NOTDIR       Not Directory
           IS_NMLDIR       Normal Directory
           IS_HIDDIR       Hidden Directory

The sec2prim program then scans the status array looking for inodes pointing to
directories.  When an inode pointing to a directory is found, sec2prim reads in
the directory and scans each directory entry to determine if it points to a
file stored in the file system.  If the file is not stored in the file system,
the directory entry is deleted and the directory block is updated on disk.

After all the directory entries are updated, sec2prim updates the superblock by
setting the low and high water marks to the previous high water mark, rebuilds
the free inode list and then rewrites the superblock to disk.

Secondary filesystems only store directories and files which have been properly
marked with the store (for user-replicated filesystems) or chfstore (for
system-replicated filesystems) commands.  Care should be taken that all files
which need to be saved are stored on the secondary filesystem.  If parent
directories of stored files are not correctly marked, the stored files on the
secondary filesystem will be reattached by fsck in the lost+found directory.
The lost+found directory itself must be stored on the secondary, or no
unreferenced files can be reattached.  Backbone filesystems store all files by
design, so this marking is not an issue there.

Note that fsck will need to be run to finish the conversion of the secondary or
backbone filesystem begun by sec2prim.  In the case where extensive rebuilding
of a secondary filesystem is required, fsck may need to run more than once.  In
all cases, it is better to run sec2prim and fsck on a quiescent filesystem
(unmounted or in single user or system maintenance mode), to insure the
integrity of stored filesystem data.

FLAGS

-a   list all files to be removed by inode and filename.  If this flag is
     omitted, list the inode and filename of files to be removed which have the
     filename i386 or are not in a hidden directory.

-u   update disk.  If this flag is omitted, the changes are not written to
     disk.




Processed November 8, 1990       SEC2PRIM(1,C)                                2





SEC2PRIM(1,C)               AIX Commands Reference                SEC2PRIM(1,C)



EXAMPLES

Before using sec2prim, the filenames should be examined to ensure that all
critical files have been replicated in the local file system.  The full path
can be determined from the inode using ncheck.

           % ncheck -i 7155  /dev/hd02

           /dev/hd02:
           7155       /bin/join@/i386

          % sec2prim /dev/hd02

         Device /dev/hd02
           Volume Name              VOLXXX
           File system Name         (1) /
           Device Size              30720000
           I_Nodes                      9984
           Fstore Flags             00000e00

The output below shows the inode number and the file name of the files which
will be removed.  The following files would be removed if the -u was specified.

           3583   mp
           7155   i386
           2344   . .
     1712   Stored and not linked

ERROR CONDITIONS

The following error conditions can occur.  Any of these cause the program to
abort immediately.

           Unable to open source device
             Open failed on source device.

           Invalid Header in Super Block
             The superblock in the file system did not contain the magic r
             indicating it was a superblock.

           Primary Pack of File system
             The source device is already a primary copy of a replicated
           Non Replicated File system
             The source device is not a replicated file system.

           Unable to allocate status table
             There was insufficient RAM to allocate a status table for each

           Disk seek error
           Disk read error
           Disk write error




Processed November 8, 1990       SEC2PRIM(1,C)                                3





SEC2PRIM(1,C)               AIX Commands Reference                SEC2PRIM(1,C)



RELATED INFORMATION

See the following commands:  "fsck, dfsck,"  "rdevcvt,"  "store," and
"chfstore."

See AIX Administration Guide:  Chapter 3:  "File System Backup."

See AIX Technical Reference Vol II:  "fs" and "inode" in File Formats.















































Processed November 8, 1990       SEC2PRIM(1,C)                                4



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026