Moving a Filesystem

Edit: Link to technote no longer works.

Originally posted September 20, 2011 on AIXchange

More than once I’ve found myself on a system where all of the filesystems were placed in rootvg rather than split out into different volume groups. By default, the mksysb backs up all of rootvg. You can set up exclude lists, but then you must remember to maintain those lists. If someone adds another filesystem to rootvg without excluding it from the mksysb, those backups can become huge. In a perfect world we’d keep our mksysb files small by putting non rootvg filesystems in application volume groups.

I had a filesystem that was mistakenly placed in rootvg on an AIX 6 machine. I wanted to move that filesystem into datavg. It was a very simple procedure. When searching for help, I found this IBM
technote.

First I ran:

umount /export/myfilesystem

Then I ran:

cplv –v datavg fslv01

This returned with:

cplv: Logical volume fslv01 successfully copied to fslv03

The document told me to run logform, but when I did I got:

logform /dev/fslv03
logform: 0507-503 file system /dev/fslv03 does not exist. Change
logical volume type to be jfs2log for an outlinelog

I double checked in /etc/filesystems, and sure enough I had an inline log set up. So I decided to gamble and just run the chfs command as outlined in the document:

chfs -a dev=/dev/fslv03 -a log=INLINE /export/myfilesystem

Then I ran my fsck as instructed:

fsck -p /dev/fslv03

Then I mounted my filesystem:

mount /export/myfilesystem

Like magic, my filesystem moved and it was all pretty painless.

I realize that this method requires unmounting the fileystem that’s being moved, so this maintenance may need to occur during off-hours. Still, it’s nice to know that the option exists to move a filesystem to another volume group should the need arise.

Now I have a clean rootvg and my application data is in datavg.