Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.3: Move swap to another partition in Panther' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Move swap to another partition in Panther
Authored by: Frederico on Nov 14, '03 07:52:00PM

I never meant to imply that using SwapCop was at all dangerous -- not sure where you read that into my statements -- indeed, SwapCop was not only a simple, elegant, easy to use solution in Jaguar, but Joshua Schrier and Scott Boone had the intelligence and foresight to allow SwapCop to fail gracefully in the event that the OS or /etc/rc file were to change in future. For most people under Panther, this is the case.

I'm also sensing some animosity towards me, or a sense that I am expressing animosity towards you; I assure you that I am only trying to explore this issue for the benefit of all. If I have somehow offended you, I'm sincerely sorry for having done so.

Regards

Frederico



[ Reply to This | # ]
10.3: Move swap to another partition in Panther
Authored by: gvitale on Nov 15, '03 03:40:16AM

Ok, let's get this straight: with my original post I did not mean to criticise the suggested strategy for swap relocation, but just point out an (easier) alternative that worked for me (and others); no animosity expressed or implied. That sed, I'm not knowledgeable enough of the OSX boot process to get into the technicality of the discussion. I DO NOT MEAN TO BE POLEMIC.
Federco, here is my Panther's /etc/rc (after running SwapCop, which I did after clean format-and-install Panther in the second 7GB logical partition of my 20 GB drive, to relocate swap to the first 700 MB logical partition; I'm using this setup since about 3 weeks and I haven't experienced no problems):

#!/bin/sh

##
# Multi-user startup script.
#
# Copyright 1997-2002 Apple Computer, Inc.
#
# Customize system startup by adding scripts to the startup
# directory, rather than editing this file.
##

stty intr undef
stty kill undef
stty quit undef
stty susp undef
stty start undef
stty stop undef
stty dsusp undef

. /etc/rc.common

stty status '^T'

##
# Handle arguments passed from init.
##

BootType=$1; shift;

if [ -z "${BootType}" ]; then
BootType="multiuser"
fi

VerboseFlag=""
SafeBoot=""

args=$(/usr/bin/getopt vx $*)
set -- ${args};
for option; do
case "${option}" in
-v)
VerboseFlag="-v"
;;
-x)
SafeBoot="-x"
;;
esac;
done;

if [ -d /System/Installation -a -f /etc/rc.cdrom ]; then
/etc/rc.cdrom ${BootType}
# We shouldn't get here; CDIS should reboot the machine when done
echo "CD-ROM boot procedure complete"
halt
exit 0
fi

netboot=$(/usr/sbin/sysctl -n kern.netboot)

# Mount essential local filesystems (according to /etc/fstab).
echo "Mounting local filesystems"

mount -vat hfs
mount -vat ufs
mount -t fdesc -o union stdin /dev
mkdir -p -m 0555 /.vol && chmod 0555 /.vol && mount_volfs /.vol

# 3281054 Cannot start up if /private/var/tmp is missing (system should recreate it)
mkdir -p -m 01777 /private/var/tmp

if [ -f /etc/rc.installer_cleanup ]; then
/etc/rc.installer_cleanup ${BootType}
fi

. /etc/rc.cleanup

BootCacheControl=/System/Library/Extensions/BootCache.kext/Contents/Resources/BootCacheControl
if [ ! -f $BootCacheControl ]; then
BootCacheControl=/usr/sbin/BootCacheControl
fi
if [ "${SafeBoot}" != "-x" -a -x "${BootCacheControl}" ]; then
${BootCacheControl} start
fi

# System tuning
sysctl -w kern.maxvnodes=$(echo $(sysctl -n hw.physmem) '33554432 / 512 * 1024 +p'|dc)
sysctl -w kern.sysv.shmmax=4194304
sysctl -w kern.sysv.shmmin=1
sysctl -w kern.sysv.shmmni=32
sysctl -w kern.sysv.shmseg=8
sysctl -w kern.sysv.shmall=1024
if [ -f /etc/sysctl-macosxserver.conf ]; then
awk '{ if (!index($1, "#") && index($1, "=")) print $1 }' < /etc/sysctl-macosxserver.conf | while read
do
sysctl -w ${REPLY}
done
fi

if [ -f /etc/sysctl.conf ]; then
awk '{ if (!index($1, "#") && index($1, "=")) print $1 }' < /etc/sysctl.conf | while read
do
sysctl -w ${REPLY}
done
fi

# Logs are important. Start syslogd after the boot disk becomes r/w but before
# everything else starts. In the future, we should launch this lazily when it
# is first needed.
ifconfig lo0 127.0.0.1 up
/usr/sbin/syslogd -s -m 0

# Create mach symbol file
rm -f /mach.sym
sysctl -n kern.symfile
if [ -f /mach.sym ]; then
rm -f /mach
ln -s /mach.sym /mach
else
rm -f /mach
ln -s /mach_kernel /mach
fi

if [ "${SafeBoot}" = "-x" ]; then
echo "Configuring kernel extensions for safe boot"
touch /private/tmp/.SafeBoot
kextd -x
else
echo "Configuring kernel extensions"
kextd
fi

# Load [ideally on demand] Mach bootstrap based services
/usr/libexec/register_mach_bootstrap_servers /etc/mach_init.d

# We hope to launch portmap on demand in the next major release of Mac OS X,
# but until then, we need to inline in here for reasons not worth going into in
# this file. Static reasons to run portmap today include:
#
# - if there are NFS exports, or
# - if NFS locking is on (NFSLOCKS=-YES-), or
# - if there are NetInfo domains other than "local", or
# - if the local domain has any non-loopback values for "trusted_networks".
# - if xinetd has a portmap based service
#
# Explicitly setting NETINFOSERVER=-YES- forces portmap to run.
#
# If portmap is not started now, it will be started later if
# NFSLOCKS=-AUTOMATIC- and an NFS locking request is made.
##
if [ "${RPCSERVER:=-AUTOMATIC-}" = "-AUTOMATIC-" ]; then
RPCSERVER=-YES-
nfs_exports_ni=$(nicl -raw /var/db/netinfo/local.nidb -list /exports 2> /dev/null | wc -w)
nfs_exports_etc=$(grep -v '^[[:space:]]*\(#\|$\)' /etc/exports 2> /dev/null | wc -l)
nfs_exports=$(($nfs_exports_ni + $nfs_exports_etc))
ni_not_local=$(/bin/ls -1d /var/db/netinfo/*.nidb | sed 's:/var/db/netinfo/local.nidb::' | wc -w)
ni_local_export=$(nicl -raw /var/db/netinfo/local.nidb -read / trusted_networks 2>&1 | sed 's/trusted_networks://' | sed 's/127[^ ]*//g' | wc -w)
total=$(($nfs_exports + $ni_not_local + $ni_local_export))
[ "${total}" -eq 0 ] && RPCSERVER=-NO-
[ "${NFSLOCKS:=-AUTOMATIC-}" = "-YES-" ] && RPCSERVER=-YES-
[ "${NETINFOSERVER:=-NO-}" = "-YES-" ] && RPCSERVER=-YES-
[ "${NISDOMAIN:=-NO-}" != "-NO-" ] && RPCSERVER=-YES-
grep -ri rpc /etc/xinetd.d >/dev/null 2>&1 && RPCSERVER=-YES-
fi

if [ "${RPCSERVER}" = "-YES-" ]; then
portmap
fi

# We would also like to start "netinfo" on demand too, but we can't for various
# reasons at the moment. Start it here for now:
#
# Create local NetInfo database if it doesn't exist
if [ ! -d /var/db/netinfo/local.nidb ]; then
echo "Creating local NetInfo database"
mkdir -p /var/db/netinfo
/usr/libexec/create_nidb
rm -f /var/db/.AppleSetupDone
fi

# nibindd is required if there are NetInfo domains other than "local", or
# if the local domain has any non-loopback values for "trusted_networks".
if [ "${NETINFOSERVER:=-AUTOMATIC-}" = "-AUTOMATIC-" ]; then
NETINFOSERVER=-YES-
ni_not_local=$(/bin/ls -1d /var/db/netinfo/*.nidb | sed 's:/var/db/netinfo/local.nidb::' | wc -w)
ni_local_export=$(nicl -raw /var/db/netinfo/local.nidb -read / trusted_networks 2>&1 | sed 's/trusted_networks://' | sed 's/127[^ ]*//g' | wc -w)
total=$(($ni_not_local + $ni_local_export))
if [ "${total}" -eq 0 ]; then
NETINFOSERVER=-NO-
fi
fi

# If nibindd is not required, we just start the local NetInfo daemon.
if [ "${NETINFOSERVER}" = "-YES-" ]; then
nibindd
else
cd /var/db/netinfo
netinfod -s local
cd /
fi

if [ ! "${netboot}" = "1" ] ; then
if [ ! -f /System/Library/Extensions.mkext -o \
/System/Library/Extensions.mkext -ot /System/Library/Extensions ]; then

if [ "${SafeBoot}" != "-x" ]; then
echo "Updating kernel extensions cache"
rm -f /System/Library/Extensions.mkext
/usr/sbin/kextcache -elF -a `arch`
fi
fi
fi

update

echo "Starting virtual memory"

swapdir=/private/var/vm
if [ "${netboot}" = "1" ]; then
sh /etc/rc.netboot setup_vm ${swapdir}
fi

# Make sure the swapfile exists
if [ ! -d ${swapdir} ]; then
echo "Creating default swap directory"
mount -uw /
mkdir -p -m 755 ${swapdir}
chown root:wheel ${swapdir}
else
rm -rf ${swapdir}/swap*
fi

#dynamic_pager -F ${swapdir}/swapfile

appprofiledir=/private/var/vm/app_profile

if [ ! -d ${appprofiledir} ]; then
if [ -f ${appprofiledir} ]; then
mv -f ${appprofiledir} "${appprofiledir}_"
fi
mkdir -p -m 711 ${appprofiledir}
chown root:wheel ${appprofiledir}
fi


if [ "${SafeBoot}" != "-x" -a -x "${BootCacheControl}" ]; then
${BootCacheControl} tag
fi

# Set language from CDIS.custom - assumes this is parse-able by sh
if [ -f /var/log/CDIS.custom ]; then
. /var/log/CDIS.custom
fi

# Start the Language Chooser. This code should be able to go away as far as I
# know once loginwindow becomes dynamic and SystemStarter exits the GUI
# business.
STARTPBS="/System/Library/CoreServices/pbs" # apps stall w/o
BUDDYCOOKIE="/var/db/.AppleSetupDone"
LCACOOKIE="/var/db/.RunLanguageChooserToo"
STARTLCA="/System/Library/CoreServices/Language Chooser.app/Contents/MacOS/Language Chooser"

if [ -x "$STARTLCA" -a -x "$STARTPBS" -a ! -f "$BUDDYCOOKIE" -a -f "$LCACOOKIE" ]; then
"$STARTPBS" &
pbspid=$!
"$STARTLCA"
kill $pbspid # XSelect does this independently
fi

if [ ! -s "/var/log/CDIS.custom" ]; then
echo "Language Chooser seems to have failed; defaulting to English"
echo "LANGUAGE=English" > "/var/log/CDIS.custom"
fi

export LANGUAGE

SystemStarter -gr ${VerboseFlag} ${SafeBoot}

exit 0

Upon request I can post Jaguar's /etc/rc obtained as described above.

Sorry for the long post and best regards.
gaetano



[ Reply to This | # ]
10.3: Move swap to another partition in Panther
Authored by: gvitale on Nov 15, '03 03:47:17AM

For the sake of completeness, this is /etc/hostconfig (the second file that SwapCop modifies in your system):

##
# /etc/hostconfig
##
# This file is maintained by the system control panels
##
# Network configuration
HOSTNAME=-AUTOMATIC-
ROUTER=-AUTOMATIC-
# Services
AFPSERVER=-NO-
AUTHSERVER=-NO-
AUTOMOUNT=-YES-
CUPS=-YES-
IPFORWARDING=-NO-
IPV6=-YES-
MAILSERVER=-AUTOMATIC-
NETINFOSERVER=-AUTOMATIC-
NFSLOCKS=-AUTOMATIC-
NISDOMAIN=-NO-
RPCSERVER=-AUTOMATIC-
TIMESYNC=-NO-
QTSSERVER=-NO-
WEBSERVER=-NO-
SMBSERVER=-NO-
DNSSERVER=-NO-
COREDUMPS=-NO-
VPNSERVER=-NO-

VIRTUALMEMORY="/Volumes/Swap/.vm"
CRASHREPORTER=-YES-



[ Reply to This | # ]