Cover V09, I11


AIX Filesystem ReOrg Made Simple

Bill Bollenbach

AIX utilizes the Journal File System (JFS) under Logical Volumes (LV) within the ODM (Object Data Manager). Using JFS makes additional space allocation a simple dynamic process, and there are few problems surrounding its use. One of these problems occurs when reducing the size of a filesystem.

There is no painless way to reduce the size of a JFS filesystem on the fly. The typical recommendation is to backup the data, destroy the original JFS, then recreate it (at a smaller size), and rebuild it from backups. This works, but it can be a disruptive and time-consuming process. It can also require a temporary space allocation that may or may not be available.

The following process was developed to allow the sys admin to clone the filesystem and rename it with the new (smaller) size criteria. It is not strictly dynamic, but careful planning and utilization can reduce the outage to under a minute or two in most cases. If you are dealing with large enabled JFS file systems of several GBs, it will obviously take a bit longer.

The process assumes that you have a moderate size JFS filesystem on hdisk2, and a mirrored copy on hdisk3:

1. Break mirrors:

rmlvcopy fslv.old 1 hdisk2
2. Create new filesystem ( on free hdisk at a smaller size:

smitty lv
Create the fs.newlv:

smitty fs
Create the JFS

mount fs.newlv
3. tar fs.old to buffer, and untar to target without tmpfile:

cd /fs.old
The following tar command has the potential to destroy existing data in the event of typographical errors. Therefore, it is recommended to precede it with a # to comment it out, then recall and check for accuracy prior to actual execution:

#tar -cvf - .|(cd /;tar -xvpf -)

tar -cvf - .|(cd /;tar -xvpf -)
4. Check the results to ensure the copy was correct:

ls -alR /fs.old > fsold
ls -alR / > fsnew
diff fsold fsnew (should be none of note)
5. Reorg filesystem:

umount /fs.old
umount /

chfs -m fs.old.flag fs.old \
   (rename orig fs.old to fs.old.flag)
This changes the mountpoint of the old filesystem freeing the original:

chfs -m fs.old \
   (rename new fs to old fs name)
This changes the mountpoint of the new filesystem to the original one:

mount /fs.old.flag
mount /fs.old \
   (The new smaller JFS is here now)
6. Check the results to ensure correct copy:

ls -alR /fs.old fsold2
diff fsold fsold2 (should be none of note)
7. When assured that both filesystems are the same, remove original filesystem:

umount /fs.old.flag
rmfs -r fs.old.flag
8. Remirror the new, smaller filesystem:

mklvcopy -k fs.oldlv 2 hdisk3
9. End up with:

/dev/fs.newlv          /fs.old
10. Rename the lv and complete the switch:

umount fs.oldlv
chlv -n fs.oldlv fs.newlv


mount /dev/fs.oldlv
11. The change is now complete, and you should see a smaller sized JFS with the old name and mount point:

/dev/fs.oldlv           /fs.old

About the Author

Bill Bollenbach has been primary AIX administrator of numerous IBM machines in a shared environment for three years, and is now collaborating on a major ERP project for OneOK, INC, a regional integrated energy company. He can be contacted at: