AIX jfs to jfs2
id : zt261anx3n
category : computer
blog : unix
created : 05/09/11 - 16:54:01
mksysb
  • First of all run mkzfile to save current system state and create /image.data on lpar :
# mkszfile

  • Copy old system /image.data file :
# cd /
# cp image.data image.data.jfs

  • Modify it with this sed command :
sed -e "
s/TYPE= jfs$/TYPE= jfs2/g
s/TYPE= jfslog$/TYPE= jfs2log/g
s/COPIES= 2$/COPIES= 1/g
s/hdisk0 hdisk2/hdisk0/g
s/hdisk2 hdisk0/hdisk0/g
s/FS_FS= 4096$/FS_JFS2_BS= 4096/g
s/FS_NBPI= 4096$/FS_JFS2_SPARSE= yes/g
s/FS_COMPRESS= no$/FS_JFS2_INLINELOG= no/g
s/FS_BF= true$/FS_JFS2_SIZEINLINELOG=/g
s/FS_AGSIZE= 64$//g
" image.data.jfs > image.data

    • Change jfs type to jfs2 type.
    • Change jfslog type to jfs2log type.
    • If root vg is mirrored keep only first disk (you can recreate mirror after mksysb restoration).
    • Delete second dump lv if rootvg is mirrored.
  • Copy /etc/filesystems file and modify it :
# cp -p /etc/filesystems /etc/filesystems.jfs

  • Change all jfs occurence to jfs2 :
sed -e "
s/vfs.*= jfs *$/vfs             = jfs2/g
" /etc/filesystems.jfs > /etc/filesystems

  • Run mksysb on an nfs share :
# mount nfs_server:/app/nim/mksysb/lpar /mnt
# mksysb -ep /mnt/mksysb_lpar

  • Don't forget to restore file after mksysb creation if you need to reboot old lpar :
# umount /mnt
# mv /etc/filesystems.jfs /etc/filesystems
# mkszfile

  • Restore mksysb and you're done !
savevg
  • If you need switch an entire vg from jfs to jfs2 do it with savevg :
  • savevg with savevg command (example with foovg) :
# savevg -i -v -p -f /mnt/foovg-lpar.savevg foovg > /mnt/savevg.log 2>&1

  • Check if there is no error while saving :
# grep -v "^a" /mnt/savevg.log

  • Before restvg :
    • restore foovg.data in a temporary directort :
# restore -xqvdf foovg-lpar.savevg ./tmp/vgdata/foovg/foovg.data
# mv ./tmp/vgdata/foovg/foovg.data /

    • Modify foovg.data :
# sed -e "
s/TYPE= jfs$/TYPE= jfs2/g
s/TYPE= jfslog$/TYPE= jfs2log/g
s/COPIES= 2$/COPIES= 1/g
s/FS_FS= 4096$/FS_JFS2_BS= 4096/g
s/FS_NBPI= 4096$/FS_JFS2_SPARSE= yes/g
s/FS_COMPRESS= no$/FS_JFS2_INLINELOG= yes/g
s/FS_BF= true$/FS_JFS2_SIZEINLINELOG= 8/g
s/FS_AGSIZE= 64$//g
" foovg.data > foovg.data.new

  • Restore vg structure :
# restvg -qrf /mnt/foovg-lpar.savevg -d /mnt/foovg.data.new -P 128 hdisk1 

  • P : pp size.
  • Check if all filesystems on foovg are mounted, if some are closed there is an error in foovg.data.new, you must have all these line for every fs :
  FS_JFS2_SPARSE= yes
  FS_JFS2_INLINELOG= yes
  FS_JFS2_SIZEINLINELOG= 8
  FS_JFS2_QUOTA= no
  FS_JFS2_DMAPI= no
  FS_JFS2_VIX= no

  • Set automount on filesystem :
for i in `lsvg -l foovg|grep jfs2|grep -v jfs2log|awk '{print $7}'` ; do chfs -A yes $i ; done

  • Go on / , it's very important
  • Restore each fs :
# for i in `lsvg -l foovg|grep jfs2|grep -v jfs2log|awk '{print $7}'` ; do restore -xqvdf /mnt/foovg-lpar.savevg .$i ; done