Recreating AIX Filesystems
From Wikistix
This procedure can be used to re-create an AIX filesystem. You might do this to:
- Convert jfs to jfs2.
- Convert from jfs to largefile enabled jfs.
- Change NBPI for jfs.
- Shrinking a filesystem.
- etc.
Example
Converting a jfs filesystem called "/app/foo" to jfs2:
Check existing configuration
# mount | grep foo
/dev/foolv /app/foo jfs Apr 06 15:12 rw,log=/dev/loglv00
/dev/barlv /app/foo/bar jfs2 Apr 06 15:12 rw,log=/dev/hd8
# df -k | grep foo
/dev/foolv 196608 188628 5% 197 1% /app/foo
/dev/barlv 65536 61188 7% 309 3% /app/foo/bar
# lslv foolv
LOGICAL VOLUME: foolv VOLUME GROUP: rootvg
LV IDENTIFIER: 00508ada00004c00000000fffcbd4cdd.14 PERMISSION: read/write
VG STATE: active/complete LV STATE: opened/syncd
TYPE: jfs WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 64 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 3 PPs: 3
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 32
MOUNT POINT: /app/foo LABEL: /app/foo
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?: NO
Unmount filesystem and any lower mounted filesystems
# umount /app/foo/bar
# umount /app/foo
Mount 'old' filesystem read-only
# mount -r /app/foo
Create 'new' filesystem
# mklv -t jfs2 -y foolvnew rootvg 3
foolvnew
# crfs -v jfs2 -d /dev/foolvnew -m /mnt/app/foo -A yes
File system created successfully.
196396 kilobytes total disk space.
New File System size is 393216
Mount 'new' filesystem
# mount /mnt/app/foo
Copy data using favorite method
# cd /app/foo
# tar -cf - . | (cd /mnt/app/foo && tar -xf -)
Unmount both filesystems
# cd /
# umount /mnt/app/foo
# umount /app/foo
Delete 'old' filesystem
# rmfs /app/foo
rmlv: Logical volume foolv is removed.
Rename 'new' filesystem
# chfs -m /app/foo /mnt/app/foo
# chlv -n foolv foolvnew
Fix mount point permissions
# chmod 555 /app/foo
Remount filesystems
# mount /app/foo
# mount /app/foo/bar
Check
# mount | grep foo
/dev/foolv /app/foo jfs2 Apr 06 15:12 rw,log=/dev/hd8
/dev/barlv /app/foo/bar jfs2 Apr 06 15:12 rw,log=/dev/hd8
# df -k | grep foo
/dev/foolv 196608 194420 2% 184 1% /app/foo
/dev/barlv 65536 61188 7% 309 3% /app/foo/bar
Clean up
# rm -rf /mnt/app