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.

LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


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,


You can have /var on any disk controller, so no need to vorry about lv names etc.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.