Wednesday, October 15, 2008

How to convert a rootvg from jfs to jfs2

1. Create an /image.data file
# mkszfile


2. Edit the /image.data file to create JFS2 filesystems


I edited each of the fsdata stanzas converting


fs_data:
FS_NAME= /opt
FS_SIZE= 131072
FS_MIN_SIZE= 12320
FS_LV= /dev/hd10opt
FS_FS= 512
FS_NBPI= 4096
FS_COMPRESS= no
FS_BF= false
FS_AGSIZE= 8


to


fs_data:
FS_NAME= /opt
FS_SIZE= 131072
FS_MIN_SIZE= 12320
FS_LV= /dev/hd10opt
FS_JFS2_BS= 4096
FS_JFS2_SPARSE= yes
FS_JFS2_INLINELOG= no
FS_JFS2_SIZEINLINELOG= 0


I edited each jfs lv, changing "TYPE = jfs" to "TYPE = jfs2".
I also edited the jfslog to be TYPE = jfs2log.


3. Edit /etc/filesystems and for each jfs filesystem in rootvg, change
"jfs" to "jfs2" in the vfs line. Check that each filesystem has
options = rw.


Here's an excerpt from my edited /etc/filesystems file.


/:
dev = /dev/hd4
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
type = bootfs
vol = root
free = true
account = true
options = rw


/home:
dev = /dev/hd1
vfs = jfs2
log = /dev/hd8
mount = true
check = true
free = false
account = true
options = rw


/usr:
dev = /dev/hd2
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
type = bootfs
free = false
account = true
options = rw


4. Take the mksysb, but without the -i flag (since that will create a
new /image.data file, overwriting your amended one).


5. Restore the mksysb as normal.

Steps required to replace a failing PV from a non-root VG

--> Backup all filesystems found on the failing PV.
--> lspv -l (lspv -l hdisk2) To determine which filesystem(s) are found on the PV in question.

--> Find out how the LVs are laid-out on the PV so you will know how to re-create them when the time comes.
lslv -m (lslv -m oracle) You will use the output of the lslv command to serve as a template for creating a map file for this LV later on.

--> Unmount all filesystems on that PV. umount to unmount each filesystem from the PV in question.

--> Remove all LVs found on that PV. rmlv (rmlv /oracle)

--> Remove the questionable PV from the system. reducevg

--> Remove the PV entry from the ODM database. rmdev -l -d (rmdev -l hdisk2 -d)

--> Shutdown the system: Shutdown -F

--> Remove the bad PV and install the new PV

--> Add the new PV to the VG in question. extendvg (eg., extendvg datavg hdisk2)

--> Re-create the LVs removed from the OLD PV to the NEW PV.
mklv -y -m (mklv -y oracle -m oracle.map oraclevg 200 hdisk2)
The map file is assembled from the output generated from the lslv -m command in step 2 above. Do this for each LV that existed on the removed PV.

--> Re-size the filesystems on the new PV. mkfs /dev/ (mkfs /dev/oracle) Do this for each file system that existed on the removed PV.

--> Perform a filesystem check before mounting it. fsck -f /dev/ (fsck -f /dev/oracle)

--> Mount all filesystems on that PV. mount (mount /oracle)

--> Now restore the data you backed up