System information

44 Sharing and maintaining SLES 10 SP2 Linux under z/VM
1.6.2 Creating a prototype read-only root Linux
The script mnt2rogld.sh and some modified files were composed to help facilitate creating a
read-only root system from a conventional read-write Linux system. Understand that these
are neither supported, nor heavily tested. Again, check with your Linux distributor and/or
support company to be sure that such a system will be supported. If you implement it, test
everything well.
The global variables and functions calls are at the bottom of the script. Here are the global
variables:
sourceID="S10RWMNT"
targetID="S10ROGLD"
rorDiffs="/usr/local/sbin/boot.rootfsck.diffs"
fstabFile="/usr/local/sbin/fstab.ror"
The source user ID is S10WRMNT and the target user ID is S10ROGLD as has been described.
The global variable rorDiffs specifies the diff file shipped with the tar file that is used to
modify the /etc/init.d/boot.rootfsck script. The variable fstabFile specifies the modified
/etc/fstab file also shipped with the tar file. Because these user ID names, boot script and
file system configuration file are hard-coded into the script, all the steps in this section must
be performed identically, or the script could easily fail.
The function calls are as follow:
checkID $sourceID
checkID $targetID
linkSourceDisks
linkTargetDisks
enableSourceDisks
enableTargetDisks
copySystem
mountSourceRoot
mountTargetDisks
modifySystem
cleanUp
echo "Exiting with rc 0!"
exit 0
See 1.10.4, “The mnt2rogld.sh script” on page 73 for a complete listing of script. Here is a
high level description of the functions.
򐂰 The first two function calls to checkID verify that the source and target user IDs are logged
off.
򐂰 The next two function calls, linkSourceDisks and linkTargetDisks utilize vmcp to link to
the S10RWMNT and S10ROGLD minidisks in read-only and read-write mode, respectively.
򐂰 The next two function calls, enableSourceDisks and enableTargetDisks, utilize the Linux
chccwdev command to enable the source and target disks.
򐂰 The next function copySystem, calls copyDisk to copy all minidisks. The copyDisk function
uses the Linux dasdfmt and dd commands.
򐂰 The next two function calls mountSourceRoot and mountTargetDisks mount the source and
target disks following the Linux file system hierarchy over the directories /mnt/source/
and /mnt/target/.
򐂰 The function modifySystem is where some magic occurs, so it is analyzed in detail. Here is
the code:
function modifySystem()
{