Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filesystem Reduction?

Status
Not open for further replies.

Roomer

Technical User
Oct 1, 2001
100
0
0
GB
Anybody reduced a filesystem size (v 4.3.3.0) ??

Any info would be appreciated..

Roomer
 
I've used both procedures below many times without a problem. Good luck!

If there is not enough free space on the disk(s) to have both filesystems allocated, use the first procedure...

1. Backup to a tape drive if one is available. Use the backup command.

monkey:root:/#> /usr/sbin/backup -f/dev/rmt0 -0 /usr/local

2. Unmount and remove the filesystem. (Verify your backup first)

monkey:root:/#> umount /usr/local
monkey:root:/#> rmfs /usr/local

3. Recreate your logical volume and file system with the smaller size.

monkey:root:/#> mklv -y hd99 -t jfs rootvg 24 hdisk0
or use SMIT: 'smitty mklv' to create your logical volume and
'smitty crjfslvstd' to create your smaller jfs filesystem on top of the previously created logical volume.

4. Mount your filesystem.

monkey:root:/#> mount /dev/hd99

5. Restore from you tape backup

monkey:root:/#> /usr/sbin/restore -rq -f/dev/rmt0 -d/ -v

or use the 'smitty restfilesys' fastpath.

|----------|-----------|----------|-----------|----------|
|----------|-----------|----------|-----------|----------|

Secondly:

BTW, if you are not mirrored you should ignore the first step and Step 8.

The process assumes that you have a moderate size JFS filesystem on hdisk2, and a mirrored copy on hdisk3:


1. Break mirrors:

rmlvcopy fslv.old 1 hdisk2

2. Create new filesystem (fs.new) on free hdisk at a smaller size:

smitty lv
Create the fs.newlv:

smitty fs
Create the JFS fs.new:

mount fs.newlv

3. tar fs.old to buffer, and untar to target fs.new without tmpfile:

cd /fs.old

This tar command has the potential to destroy existing data in the event of typographical errors. It is recommended to precede it with a # to comment it out, then recall and check for accuracy prior to actual execution:

#tar -cvf - .|(cd /fs.new;tar -xvpf -)

tar -cvf - .|(cd /fs.new;tar -xvpf -)

4. Check the results to ensure the copy was correct:

ls -alR /fs.old > fsold
ls -alR /fs.new > fsnew
diff fsold fsnew (should be none of note)

5. Reorg filesystem:

umount /fs.old
umount /fs.new

chfs -m fs.old.flag fs.old (rename orig fs.old to fs.old.flag)
This changes the mountpoint of the old filesystem freeing the original:

chfs -m fs.old fs.new (rename new fs to old fs name)
This changes the mountpoint of the new filesystem to the original one:

mount /fs.old.flag
mount /fs.old (The new smaller JFS is here now)

6. Check the results to ensure correct copy:

ls -alR /fs.old fsold2
diff fsold fsold2 (should be none of note)

7. When assured that both filesystems are the same, remove original filesystem:

umount /fs.old.flag
rmfs -r fs.old.flag

8. Remirror the new, smaller filesystem:

mklvcopy -k fs.oldlv 2 hdisk3

9. End up with:

/dev/fs.newlv /fs.old

10. Rename the lv and complete the switch:

umount fs.oldlv
chlv -n fs.oldlv fs.newlv

remount

mount /dev/fs.oldlv

11. The change is now complete, and you should see a smaller sized JFS with the old name and mount point:

/dev/fs.oldlv /fs.old
 
Sorry, but I for got the step to create the filesystem from the command line. (Step 3) After creating the logical volume. It should be:

monkey:root:/#> crfs -v jfs -d hd99 -m /usr/local -A
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top