My complaint with SWAPGEN going back to when it was first announced was that it needs to know the number of blocks to format. This means that if the size or number of the vdisk(s) changes in the directory, the VM admin also has to go to the target machine's 191 disk and update the PROFILE EXEC so the right number of blocks get formatted on the right devices. Having to change things in multiple places seemed like something to be avoided.
So I wrote a Linux init script that does the whole thing internally within the guest. It finds all of the FBA disks, formats them, and runs mkswap. It also enables them in increasing priority order, so they get used before the default DASD swap partition, and it handles the diag module and enabling access via diag. We use this on about 100 guests, and it works very well. My only complaint with it is that it treats all FBA disks as swap disks, which might be a problem if we had any real FBA disks, but since we're entirely on 3390's and the odd FCP device, it's a non issue. It also generates one bogus error message that I never got around to suppressing. This version is for Red Hat (RHEL5), but it shouldn't be hard to customize for Suse. #!/bin/bash # $Id: vdswap,v 1.7 2007/11/06 20:44:38 root Exp $ # # vdswap This shell script does the following: # 1) Looks in sysfs for any FBA disks # 2) If they are not already enabled for swap, it formats # them, and enables them for swap with a higher priority # than the default disk swap space # # Should run after filesystems are mounted, before starting required daemons # that might need to be configured # # chkconfig: 2345 01 99 # Description: Formats and enables vdisk swap spaces # prog=`basename $0` start() { SYSDEV=/sys/bus/ccw/drivers/dasd-fba echo "Enabling vdisk swap spaces " modprobe -q dasd_diag_mod if ls $SYSDEV | grep -q 0.0 ; then PRIO=1 for A in $SYSDEV/0.0.* do DEVICE=`ls $A/block* | grep dasd | head -n 1` if lsmod | grep -q dasd_diag_mod ; then echo 0 > $A/online echo 1 > $A/use_diag echo 1 > $A/online sleep 1 fi DEVBASE=${DEVICE:0:${#DEVICE}-1} if ! swapon -s | grep -q $DEVBASE ; then parted -s /dev/$DEVBASE mkpartfs primary swap 1 mkswap /dev/$DEVICE swapon -p $PRIO /dev/$DEVICE let PRIO=$PRIO+1 fi done fi touch /var/lock/subsys/vdswap } stop() { echo -n $"Shutting down $prog: " rm -f /var/lock/subsys/vdswap return 0 } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status vdswap RETVAL=0 ;; restart|reload) stop start RETVAL=$? ;; condrestart) RETVAL=0 ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL -----Original Message----- From: Linux on 390 Port [mailto:linux-...@vm.marist.edu] On Behalf Of Adam Thornton Sent: Friday, September 11, 2009 12:30 PM To: LINUX-390@VM.MARIST.EDU Subject: Re: [LINUX-390] Dasd_diag_mod question On Sep 11, 2009, at 10:36 AM, Larry Uher wrote: > I guess my question would be why is a complex EXEC needed to do a > normal system administration task? A second question is why didn't > Novell provide a straightforward method for doing this and document it > in a manual (without using a complex 3rd party EXEC) ? Complex? After the description and the license and update comment blocks, it's about 240 lines. Of those, about 120 are the various ways the program can exit (with descriptive text) and the help message. That leaves about 120 lines of actual code, and those lines are not dense (e.g. one line per pipe stage). That handles both the raw FBA and the DIAG device cases. It's not a normal system administration task on any other Linux architecture. It's really quite unusual for your swap device to be destroyed and recreated every time you power on the machine. In the normal case the swap signature sits there between power cycles. That's why Dave and I wrote the thing in the first place--Linux does not generally consider needing to format the swap device as part of its normal bootup routine and rather than mess with system startup scripts and their ordering, we thought it was a lot easier to just take care of it in CMS before handing control to Linux, so that the swap device was pre-prepared like it expected. And that, by the way, is the reason Novell doesn't do it: it's not a task that's necessary on other architectures, and Novell, not surprisingly, likes to keep as much the same between platforms as possible. Adam -------------------------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. References to "Merrill Lynch" are references to any company in the Merrill Lynch & Co., Inc. group of companies, which are wholly-owned by Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Attachments that are part of this E-communication may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------------------------- ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390