Link to home
Start Free TrialLog in
Avatar of gripe
gripe

asked on

Rebuild /var inline / var logical volume naming

We have a pSeries box running AIX 5.1 which has had some bad corruption on the /var filesystem that fsck will not fix. We've decided to rebuild the filesystem from an old backup. The system is currently 'stable' on the existing /var except that certain portions of the fs (which normally go unused) will panic the box when accessed. We've decided to rebuild /var from an old backup but I have some questions:

1. Can we build /var on a new logical volume and then just swap them out by editing the mounts? This would give us the added safety net of being able to boot back on the original /var if we have problems with the new one.

2. If #1 is a yes, does /var have to be on the hd9var logical volume or can it have a different name? If it must be on hd9var, can we simply rename the original to hd9var-old and rename the new one to hd9var?

Looking for any pointers from someone who may have found themselves in a similar situation.

Thanks
Matt
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Hi,

1. Yes.
2. No. /var need to stick with hd9var. You need to boot your system into a limited function maintenance shell (Service or
Maintenance mode) from bootable AIX media.
-----
Restore the backup of /var to /var.bak

With bootable media of the same version and level as the system, boot the system into Service mode.
The bootable media can be any ONE of the following:

Bootable CD-ROM
NON_AUTOINSTALL, bootable mksysb
Bootable Install Tape
Follow the screen prompts or icons to the Welcome to Base OS menu.

Choose Start Maintenance Mode for System Recovery (Option 3). The next screen displays prompts for the Maintenance menu.

Choose Access a Root Volume Group (Option 1).
The next screen displays a warning that indicates you will not be able to return to the Base OS menu without rebooting.

Choose 0 continue.
The next screen displays information about all volume groups on the system.

Select the root volume group by number. The logical volumes in rootvg will be displayed with two options.

Choose Access this volume group and start a shell. (Option 1).
If no errors occur, proceed with the following steps.    <====== very important

Unmount the file system. (The following examples use /var. If you intend to reduce the /tmp file system, substitute /tmp for /var in the commands.) Execute:
    umount /var

Remove the file system by executing:
    rmfs /var

Determine the physical partition (PP) size of your rootvg volume group with the command:
   lsvg rootvg

Create the logical volume with one of these commands:
    mklv -y hd9var rootvg [x]     (for /var)
where x is the number of logical partitions you want to allocate. If your rootvg volume group has a PP size of 4MB, and you want the total size of the /var file system to be 40MB, then x would be 10.

Create the file system with the following command:
    crfs -v jfs -d hd9var -m /var -a check=false -a free=false -a vol=/var


NOTE: Substitute hd3 for hd9var and /tmp for /var if needed. Refer to the section Example of /etc/filesystems for the different attributes required for these filesystems.

Mount the file system:
    mount /var

 Change the ownership and permissions to the proper values, as follows:
    chmod g-s /var
    chmod 755 /var
    chown bin.bin /var
Then copy back the stuff from /var.bak. And edit /etc/filesystems to reflect the change for /var.
---------------------
Good luck,

Wesly

ASKER CERTIFIED SOLUTION
Avatar of gheist
gheist
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial