[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

System Management Guide:
Operating System and Devices

File Systems Maintenance Tasks

The simplest tasks you might need when maintaining file systems are grouped within the following table. Instructions for additional maintenance tasks are located later in this section or in How-To's for System Management Tasks.

Table 4. Maintaining File Systems Tasks
Task SMIT Fast Path Command or File
Backup by name files or directories smit backfile backup Note 1
Create and backup a JFS2 snapshot image smit backsnap backsnap Note 1
List all file systems on a disk smit lsmntdsk  
List file systems on a removable disk smit lsmntdsk
List mounted file systems smit fs
Mount a Group of File SystemsNote 5 smit mountg mount -t GroupName
Mount a JFS or JFS2Note 3 smit mountfs mount
Mount a JFS2 snapshot smit mntsnap mount -v jfs2 -o snapshot Device MountPoint
Remove a JFS or JFS2 smit rmfs
Remove a JFS2 Snapshot smit rmsnap snapshot -d SnapshotDevice
Unmount a File SystemNote 4 smit umountfs
Unmount a File System on a Removable DiskNote 4 smit umntdsk
Unmount a Group of File SystemsNote 5 smit umountg umount -t GroupName
Notes:
  1. For options, see the command description in AIX 5L Version 5.2 Commands Reference.
  2. Do not change the names of system-critical file systems, which are / (root) on logical volume 4 (hd4), /usr on hd2, /var on hd9var, /tmp on hd3, and /blv on hd5. If you use the hdn convention, start at hd10.
  3. Check the file systems before mounting by using the procedure Verify File Systems or running the fsck command.
  4. If an unmount fails, it might be because a user or process has an opened file in the file system being unmounted. The fuser command lets you find out which user or process might be causing the failure.
  5. A file system group is a collection of file systems which have the same value for the type= identifier in the /etc/filesystems file.

Recover One or More Files from an Online JFS2 Snapshot

When a file becomes corrupted, you can replace it if you have an accurate copy in an online JFS2 snapshot. Use the following procedure to recover one or more files from a JFS2 snapshot image:

  1. Mount the snapshot. For example:
    mount -v jfs2 -o snapshot /dev/mysnaplv /home/aaa/mysnap
  2. Change to the directory that contains the snapshot. For example:
    cd /home/aaa/mysnap
  3. Copy the accurate file to overwrite the corrupted one. For example:
    cp myfile /home/aaa/myfs
    copies only the file named myfile. The following example copies all files at once:
    cp -R home/aaa/mysnap /home/aaa/myfs
    For more examples, see the cp or cpio command descriptions in the AIX 5L Version 5.2 Commands Reference.

Use File Systems on CD-ROM and DVD Disks

Beginning with AIX 5.2, CDs and DVDs are automatically mounted by default but this feature can be disabled. If the feature has been disabled, use the cdmount command to mount the CDRFS or UDFS file system, for example:

cdmount cd0

When a DVD is automounted, the UDFS file system is read-only by default. If you want the automount feature or the cdmount command to automatically mount a read/write UDFS, edit the cdromd.conf file. You can also manually mount a read/write UDFS with the following command:

mount -V udfs DevName MtPt

Where DevName is the name of the DVD drive and MtPt is the mount point for the file system.

Use File Systems on Read/Write Optical Media

The following types of file systems can be used on read/write optical media:

A CD-ROM file system (CDRFS) can be stored on read/write optical media, provided that the optical media is write-protected, as well as on a CD-ROM. The following table tells you how to add, mount, or unmount a CDRFS on read/write optical media. You must specify the following information when mounting the file system:

Device name Defines the name of device containing the media.
Mount point Specifies the directory where the file system will be mounted.
Automatic mount Specifies whether the file system will be mounted automatically at system restart.
CDRFS on Optical Media Tasks
Task SMIT Fast Path Command or File
Adding a CDRFS 1 smit crcdrfs
  1. Add the file system:
    crfs -v cdrfs -p ro -dDeviceName -m MountPoint -A AutomaticMount
  2. Mount the file system:
    mount MountPoint
Removing a CDRFS2
  1. Unmount the file system:
    smit umountfs
  2. Remove the file system: smit rmcdrfs
  1. Unmount the file system:
    umount FileSystem
  2. Remove the file system:
    rmfs MountPoint
Notes:
  1. Make sure the read/write optical media is write-protected.
  2. A CDRFS file system must be unmounted before the read/write optical media can be removed.

A JFS provides a read/write file system on optical media similar to those on a hard disk. You must have system authority to create or import a read/write file system on read/write optical media (that is, your login must belong to the system group) and you must have the following information:

Volume group name
Specifies the name of the volume group
Device name
Specifies the logical name of the read/write optical drive
Mount point
Specifies the directories where the file systems will be mounted
Automatic mount
Specifies whether the file system will be mounted automatically at system restart
Notes:
  1. Any volume group created on read/write optical media must be self contained on that media. Volume groups cannot go beyond one read/write optical disk.
  2. When accessing a previously created journaled file system, the volume group name does not need to match the one used when the volume group was created.
JFS on Optical Media Tasks
Task SMIT Fast Path Command or File
Add a JFS
  1. Insert optical disk into drive.
  2. Create a volume group (if necessary):
    smit mkvg
  3. Create a journaled file system:
    smit crfs
  1. Insert optical disk into drive.
  2. Create a volume group (if necessary):
    mkvg -f -y VGName -d 1 DeviceName
  3. Create a journaled file system:
    crfs -v jfs -g VGName -a size=SizeFileSystem -m MountPoint -A AutomaticMount -p rw
  4. Mount the file system:
    mount MountPoint
Accessing previously created JFSNote 1
  1. Insert optical disk into drive.
  2. Import the volume group:
    smit importvg
  1. Insert optical disk into drive.
  2. Import the volume group:
    importvg -y VGName DeviceName
  3. Mount the file system:
    mount MountPoint
Removing a JFSNote 2
  1. Unmount the file system:
    smit umountfs
  2. Remove the file system:
    smit rmjfs
  1. Unmount the file system:
    umount FileSystem
  2. Remove the file system:
    rmfs MountPoint
Notes:
  1. This procedure is required whenever inserting media containing journaled file systems.
  2. Removing a journaled file system destroys all data contained in that file system and on the read/write optical media.

Verify File Systems

Inconsistencies can occur in file systems when the system is stopped while file systems remained mounted or when a disk is damaged. In such circumstances, it is important to verify file systems before mounting them. Also verify your file systems in the following circumstances:

Check a User-Defined File System

  1. Unmount the user-defined file system being checked.
  2. Ensure you have write permission on files in the file system. Otherwise, the fsck cannot repair damaged files even if you answer Yes to repair prompts.
  3. Use the smit fsck fast path to access the Verify a File System menu.
  4. Do one of the following:
    1. Specify the name of an individual file system to check in the NAME of file system field, or
    2. Select a general file system type to check, such as a journaled file system (JFS) in the TYPE of file system field.
  5. If you want to limit your check to the most likely candidates, specify Yes in the FAST check? field. The fast-check option checks only those file systems that are likely to have inconsistencies such as the file systems that were mounted when the system stopped at some point in the past.
  6. Specify the name of a temporary file on a file system not being checked in the SCRATCH file field.
  7. Start the file system check.

Check Root and /usr File Systems

To run the fsck command on / or /usr file system, you must shut down the system and reboot it from removable media because the / (root) and /usr file systems cannot be unmounted from a running system. The following procedure describes how to run fsck on the / and /usr file systems from the maintenance shell.

  1. With root authority, shut down your system.
  2. Boot from your installation media.
  3. From the Welcome menu, choose the Maintenance option.
  4. From the Maintenance menu, choose the option to access a volume group.
  5. Choose the rootvg volume group. A list of logical volumes that belong to the volume group you selected is displayed.
  6. Choose 2 to access the volume group and to start a shell before mounting file systems.

    In the following steps, you will run the fsck command using the appropriate options and file system device names. The fsck command checks the file system consistency and interactively repairs the file system. The / (root) file system device is /dev/hd4 and the /usr file system device is /dev/hd2.

  7. To check / file system, type the following:
    $ fsck -y /dev/hd4

    The -y flag is recommended for less experienced users (see the fsck command).

  8. To check the /usr file system, type the following:
    $ fsck -y /dev/hd2
  9. To check other file systems in the rootvg, type the fsck command with the appropriate device names. The device for /tmp is /dev/hd3, and the device for /var is /dev/hd9var.
  10. When you have completed checking the file systems, reboot the system.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]