AIX rootvg jfs => jfs2

Adott egy jfs filerendszerekkel telepitett AIX, amit kulonbozo okoknal fogva jfs2-re szeretnenk migralni. Erre a kovetkezo eljarast hasznalhatjuk: alt_disk_install segitsegevel klonozzuk a futo rendszert ures diszk(ek)re ugy, hogy az ehhez hasznalt image.data file-t atalakitjuk jfs2-re.

Az alt_disk_install egy olyan script, ami a celdiszken ugyanazt az LVM strukturat hozza letre, mint ami az aktiv diszken van, majd 'find'-dal general egy listat az osszes file-rol, es azokat az AIX backup/restore parancsokkal egyenkent atmasolja a megfelelo LV-be. Az ehhez hasznalt image.data file-ban talalt meretadatokat hasznalja, illetve a filerendszerek tipusat is innen veszi. Meglepo modon a bos.alt_disk_install fileset tartalmazza. ;-)

Takaritsuk ki a felesleges adatokat, ezt lehet egy commit-tal kezdeni:
# installp -C

Szabaditsunk fel egy diszket, amire a jelenlegi rootvg ra is fer. Peldaul szedjuk le a rootvg-rol a mirrort (ha van), es a szabadda valt diszket jeloljuk ki target-nek.
# unmirrorvg rootvg hdiskN
# lspv -l hdiskN # maradt-e meg rajta valami adat?
# reducevg rootvg hdiskN

Legeneraljuk a /image.data file-t (ez altalaban megvan).
# mkszfile

Mivel az AIX sed nem tud 'inplace' szerkeszteni:
# grep jfs /image.data # lassuk, egyaltalan mi van benne
# sed 's/jfs/jfs2/g' /image.data > /tmp/image.data_jfs2

Csereljuk ki benne a jfs stringeket jfs2-re, illetve a filerendszerek parametereit is. A regi sorokat toroljuk is!

regi (jfs):
FS_FS= 4096
FS_NBPI= 4096
FS_COMPRESS= no
FS_BF= false
FS_AGSIZE= 8

uj (jfs2):
FS_JFS2_BS= 4096
FS_JFS2_SPARSE= yes
FS_JFS2_INLINELOG= no
FS_JFS2_SIZEINLINELOG= 0

Most johet a lenyeg, az alt_disk_install. Ez altalaban 1 orat vesz igenybe, hacsak a rootvg nem tul vastag.
# alt_disk_install -B -C hdiskN -i /tmp/image.data_jfs2

-B flag: ne allitsa at a boot sorrendet (ezt ajanlatos kezzel)
-i flag utan: a szerkesztett file teljes utvonallal

Ha megvan, az uj filerendszereket hozzuk is fel, hogy atirjuk az /etc/filesystems -t (az fstab aix-es megfelelojet). Ezt meg lehet elozni azzal is, ha mar klonozas elott a regi file-t atszerkesztjuk, de ezzel azt kockaztatjuk, hogy a jelenlegi rendszer sem all fel, ha kozben elmegy az aram, vagy ha elfelejtjuk visszairni jfs-re ;-)
# alt_disk_install -W hdiskN

Itt az ujabb trukk: a tenyleges /etc/filesystems atnevezodik, igy a szerkesztendo file a /alt_inst/etc/filesystems.alt.chfs.env.save ! Az alt_disk_install ezt fogja visszanevezni /etc/filesystems-nek az umount elott.

Ha mar online van az altinst_rootvg, az ottani log device-ot formazzuk ujra (ellenorizheto a 'mount' paranccsal), nalam legalabbis enelkul nem mukodott a dolog:
# logform -V jfs2 /dev/alt_hd8

Sync-eljunk egy kicsit a biztonsag kedveert ;-)
# sync; sync; sync

Vegul 'altassuk el' az altinst_rootvg-t, azaz a jfs2 rendszert:
# alt_disk_install -S -t

Irjuk at a bootlist-et az 'uj' diszkre, es rebootoljunk. Ha nem jonne fel a rendszer, az ML/TL-nek megfelelo install CD-vel bootoljunk maintenance modba, es probaljunk rajonni, mi nem stimmel.
# bootlist -m normal -o
# bootlist -m normal hdiskN
# shutdown -Fr

Hozzászólások

Sync-eljunk egy kicsit a biztonsag kedveert ;-)
# sync; sync; sync

Én erre Linux alatt anno '94-ben, az első Linux-telepítési kísérleteimnél rászoktam. Mint kiderült, a DOS alatt jól működő VESA buszos (emlékszik még erre valaki? :) ) IDE vezérlő döglött ki tőle, mindezt a lehető legváratlanabb időpontokban. Brrr. :))

--
Q: What's the difference between Lem's Solaris and Sun's Solaris?
A: One's an alien presence that drives all who encounter it mad, and the other one's been made into a movie by Andrei Tarkovsky.

Hozza kell fuznom, hogy az 'irodalom' erre a problemara azt javasolja, hogy csinaljunk egy mksysb-t a fentiekhez hasonloan modositott image.data-val, es abbol huzzuk fel a rendszert, de nekem az alt_disk_install szimpatikusabb, mert eroforrasok szempontjabol sokkal egyszerubb vegrehajtani.

"Ha nem jonne fel a rendszer, az ML/TL-nek megfelelo install CD-vel bootoljunk maintenance modba, es probaljunk rajonni, mi nem stimmel."

Ha csak remote hozzáférésünk van, akkor az akció előtt biztosítsunk egy bekonfigurált NIM szervert az ilyen szintű igényekhez is :)
____________________________________
Az embert 2 éven át arra tanítják hogyan álljon meg a 2 lábán, és hogyan beszéljen... Aztán azt mondják neki: -"Ülj le és kuss legyen!"..

Say, you have an AIX system running with JFS and you want to migrate the FSs to JFS2 to use its benefits (online shrinking, etc). I used alt_disk_install to clone the running system to a free(d) disk, with converting the file image.data to suit the creation of jfs2.

WARNING: no warranty, make sure you have a fresh backup blah blah...

alt_disk_install is a script. It creates an identical LV structure on the target disk, then generates a list of _all_ files found on the source disk to copy them one by one using the 'tar'-like AIX commands 'backup' and 'restore'. For this, it takes the file image.data. The alt_disk_install binaries are included in bos.alt_disk_install.

Clean unnecessary data from the system, for example, commit previous updates:
# installp -C

Free a disk where the current rootvg will fit. The easiest is to unmirror rootvg (assuming that you have a symmetric mirror). Then choose the unassigned disk for the clone.

# unmirrorvg rootvg hdiskN
# lspv -l hdiskN # maradt-e meg rajta valami adat?
# reducevg rootvg hdiskN

Generate /image.data (if missing):
# mkszfile

The AIX version of sed lacks the -i (in place) option:
# grep jfs /image.data # check what is in there
# sed 's/jfs/jfs2/g' /image.data > /tmp/image.data_jfs2

Replace jfs with jfs2 and some changed filesystem parameters, and delete (don't comment out) the old lines!

old (jfs):
FS_FS= 4096
FS_NBPI= 4096
FS_COMPRESS= no
FS_BF= false
FS_AGSIZE= 8

new (jfs2):
FS_JFS2_BS= 4096
FS_JFS2_SPARSE= yes
FS_JFS2_INLINELOG= no
FS_JFS2_SIZEINLINELOG= 0

Now the most important part, alt_disk_install. It takes ~1hr on a base system without load. It has a log in /var/adm/ras.

# alt_disk_install -B -C hdiskN -i /tmp/image.data_jfs2

-B : don't set boot list automatically (better do it manually)
-i : new image.data file with full path

Whwn it finishes, wake up the new filesystems to correct /etc/filesystems there. In theory, you could do this _before_ the clone (so the modified file will be copied) but you risk being unable to boot from either disk, should the power go off or if we forget writing the changes back in the old file ;-)

# alt_disk_install -W hdiskN

Here is another pitfall: because the actual /etc/filesystems gets renamed during wake-up, you should edit /etc/filesystems.alt.chfs.env.save ! Then alt_disk_install will take care of the rename before it umounts the filesystems on the cloned disk.

While altinst_rootvg is up, reformat the fs log device (the device can be identified with 'mount'), I had to do this in order to be able to boot the new system:
# logform -V jfs2 /dev/alt_hd8

sync a few times: ;-)
# sync; sync; sync

Finally put the cloned disk (already with jfs2) back to sleep:
# alt_disk_install -S -t

Correct bootlist and try coming up with the jfs2 filesystems. If something fails, boot from your CD/DVD/whatever matching the installed OS level, andf try to figure out what went wrong.
# bootlist -m normal -o
# bootlist -m normal hdiskN
# shutdown -Fr

Here is my result (AIX runing with 32-bit kernel and jfs2):


# bootinfo -K
32
# mount
node mounted mounted over vfs date options
-------- --------------- --------------- ------ ------------ ---------------
/dev/hd4 / jfs2 Feb 04 19:49 rw,log=/dev/hd8
/dev/hd2 /usr jfs2 Feb 04 19:49 rw,log=/dev/hd8
/dev/hd9var /var jfs2 Feb 04 19:49 rw,log=/dev/hd8
/dev/hd3 /tmp jfs2 Feb 04 19:49 rw,log=/dev/hd8
/dev/hd1 /home jfs2 Feb 04 19:50 rw,log=/dev/hd8
/proc /proc procfs Feb 04 19:50 rw
/dev/hd10opt /opt jfs2 Feb 04 19:50 rw,log=/dev/hd8