• No results found

A command for importing Volume Group: recreatevg

The recreatevg command is used when you have a disk to disk copy to perform, but you want to create a unique volume and not an exact mirror. A direct dd copy would create a problem, because all the information, such as VGDAs and LVs, in one disk is copied to the other. Duplicate volume group, logical volume, and file system mount points are prevented by using the recreatevg command. The command options allow you to specify a logical volume name (a prefix label to uniquely define the Volume Group). Automatic name generation is the default (vg00). You can use this command as a tool for importing VGs from other systems and avoid creating conflicting names of logical volumes or file systems that already exist. Therefore, you can recreate the Volume Group that already exists on a specified set of disks. But if you already remove VGDA by using reducevg, the command will not work.

# lspv

6.4 JFS problems

As with the LVM, most JFS problems can be traced to problems with the underlying physical disk.

As with volume groups, various JFS features have been added at different levels of AIX, which preclude those file systems being mounted if the volume group is imported on an earlier version of AIX. Such features include large file enabled file systems and file systems with non-default allocation group size.

For the purpose of gathering information about file system and file system usage, use the following commands.

 dumpfs: Displays the super block, inodemap, and disk map information.

 fuser: Identifies processes using a file or file structure. The fuser command lists the process numbers of local processes that use the local or remote files specified by the File parameter. For block special devices, the command lists the processes that use any file on that device. This command is a good tool for finding open files that use specific file systems.

 df: Displays file system usage, including superblock, inode, disk map, deleted files still opened by a process and data block.

 du: Displays disk usage, including only data block.

 fsdb: A low level debugging tool for a file system. This is a very powerful tool that can alter file systems metadata. Incorrect usage can lead to file system corruption and loss of data.

6.4.1 Mounting file systems

Mounting makes file systems, files, directories, devices, and special files available for use at a particular location. It is the only way a file system is made accessible. The mount command instructs the operating system to attach a file system at a specified directory.

You can mount a file or directory if you have access to the file or directory being mounted and write permission for the mount point. Members of the system group can also perform device mounts (in which devices or file systems are mounted over directories) and the mounts described in the /etc/filesystems file. A user operating with root user authority can mount a file system arbitrarily by naming both the device and the directory on the command line. The /etc/filesystems file is used to define mounts to be automatic at system initialization.

Problems can occur when mounting a file system if it was not previously

unmounted correctly, as can happen if a system experiences a kernel crash. The status of the file system structure may be inconsistent and require repair actions before being mounted.

6.4.2 File system recovery

In the AIX system, the fsck command is used to check file system consistency. It can also be used to interactively perform repairs the file system.

File system inconsistencies can stem from the following:

 Stopping the system with file systems mounted.

 Physical disk deterioration or damage. This procedure should be used before mounting any file system.

The fsck command checks for the following inconsistencies:

 Blocks or fragments allocated to multiple files.

 i-nodes containing block or fragment numbers that overlap.

 i-nodes containing block or fragment numbers out of range.

 Discrepancies between the number of directory references to a file and the link count of the file.

 Illegally allocated blocks or fragments.

 i-nodes containing block or fragment numbers that are marked free in the disk map.

 i-nodes containing corrupt block or fragment numbers.

 A fragment that is not the last disk address in an i-node. This check does not apply to compressed file systems.

 Files larger than 32 KB containing a fragment. This check does not apply to compressed file systems.

 Size checks:

– Incorrect number of blocks.

– Directory size not a multiple of 512 bytes.

– These checks do not apply to compressed file systems.

 Directory checks:

– Directory entry containing an i-node number marked free in the i-node map.

– i-node number out of range.

– Dot (.) link missing or not pointing to itself.

– Dot dot (..) link missing or not pointing to the parent directory.

– Files that are not referenced or directories that are not reachable.

 Inconsistent disk map.

 Inconsistent i-node map.

The fsck command does not make changes to a mounted file system. You should unmount the file system before invoking fsck.

If the / (root) or /usr file systems require consistency checking, you should only invoke fsck on them from the maintenance shell obtained after performing a Service mode boot of the system from bootable media. Through this route, you can access the root volume group and start a shell before mounting file systems.

This will then allow you to perform the fsck operation on the / (root) and /usr file systems, since at this point they are not mounted.

Orphaned files and directories (those that cannot be reached) are, if you allow it, reconnected by placing them in the lost+found subdirectory in the root directory of the file system. The name assigned is the i-node number. If you do not allow the fsck command to reattach an orphaned file, it requests permission to destroy the file.

You can invoke the fsck command with the -y parameter, which instructs the command to take whatever actions it deems necessary to repair the file system.

Only use this option on severely damaged file systems.

When a superblock is accidentally corrupted, use the secondary block as a source. The system has a copy of the super block for recovery. This secondary block is located at 32 block. For example:

# dd count=1 bs=31k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00 1+0 records in.

1+0 records out.

6.4.3 JFS log problems

The jfslog device used with JFS can become overloaded in some situations. This can occur when a large amount of JFS I/O is taking place on file systems that share the same log device.

This problem can be avoided by creating an individual jfslog device for each file system that has a high amount of file system structure changes.