Clean up data filesystems after mksysb restoreA mksysb backup of the root volume group (rootvg) includes the file
Response: You may be thinking this is no big deal. You can always ignore errors (sigh!). Well, if you don't clean out those entries from /etc/filesystems, you won't be able to recreate file systems of the same name. If you try it (at least the way I do it), you'll take these steps:
And when you get to step 3, you'll be told the file system already exists. Then you'll try to remove it, and you'll lose the whole new logical volume with it and wished you'd listened to me.
Response: You have a few options. If you're pressed for time jump to option 4. Option 1: Edit /etc Y Option 2: Delete ALL file systems (for cowboys) What's that, you say? List all file systems using lsfs, and run rmfs to remove each of them. As for the rootvg file systems, well they're mounted anyway, so rmfs will fail. Yeehaa, cowboy! Now be serious and read on, please. Option 3: export the data volume groups before you create the mksy Th Option 4: Write a script to remove all non-rootvg file systems The script option is looking good. We want to find all file systems in /etc/filesystems: we can use lsfs and capture the mount points. We'll then have a list of file systems and we want to run rmfs for all that don't belong to rootvg. To list the ones that do belong to rootvg, you can use lsvgfs rootvg. If they're not in that list, out they go. First, here's a sample script. The explanation comes afterwards: # List all JFS2 file system mount points from lsfs for _fs in $(lsfs -cv jfs2|awk -F: '{print $1}'|grep -v "^#") do if lsvgfs rootvg | grep "${_fs}" > /dev/null
then echo "Keeping rootvg file system: ${_fs}"
else echo "Removing file system: ${_fs}" rmfs -r ${_fs}
fi done
Here are the first few lines of a typical output of this lsfs comm
The awk command will extract the first field (the file system mount point).
The grep command excludes the header line which starts with a #
S Th if lsvgfs rootvg | grep "${_fs}" > /dev/null It's not there? Then time to remove it (using
rmfs ) and its mount point directory (
-r ). rmfs -r ${_fs} . Cleaner than editing The script is short, and can be used regardless of how many non-rootvg file systems you have created. For that matter, if you have some (naughty) data file systems in rootvg, they won't get wiped out by the script. They would have been recreated as part of the rootvg when you did the mksysb restore. Also, the script approach is cleaner than editing, especially if you have many file systems. Note: This script currently only checks Enhanced Journaled File Systems (JFS2). That's in the line: lsfs -cv jfs2 If you want to search for other file systems, such as nfs, or JFS, the script would need some minor modi Th Co Other comments and suggestions can be redirected > /dev/null
|