View Full Version : Partition and Swap File Question

12-02-2002, 02:21 PM
I have some partition and swap file questions. I just got a powerbook and want to set it up to use a swap file. I haven't done this before. I'm planning on having a Mac OS X partition, Classic partition, and swap partition. I know how to create partitions (duh) but am not sure how I point the swap file to its dedicated partition under 10.2.2. Where can I read how to do this for 10.2? Are there any other things I should do when setting up a new machine? Does my set up idea seem wise?

My family needs my old computer (Blue and White G3). In it I have a 7200 rpm 40 gb HD and a 5400 rpm 30 gb HD. I'm going to install 10.2.2 on the faster 40 gb drive, but where should I install Classic and more importantly put the swap file? Would the swap file perform faster on a partition on a 7200 rpm drive where the system is or on it's own dedicated, but slower, 5400 rpm drive?

Any help or pointers would be very much appreciated. Please point me to websites or threads that contain this information.


12-02-2002, 04:04 PM

You really need to put the SWAP partition on a separate drive from the boot drive. Which leaves out getting any actual advantage for portables. Having the SWAP partition on the same drive will lead to thrashing and slow down the system.

I'm running a 400MHz G4 with 10G and 60G drives. The boot drive is the 60 partitioned into 10G slots and the SWAP partition is 1G of the 10G drive.

Here is a portion of my /etc/rc file.
# update flushes the cached blocks from the filesystem using
# the sync system call every 30 seconds. This ensures the
# disk is reasonably up-to-date in the event of a system crash.


# Start the virtual memory system.

ConsoleMessage "Starting virtual memory"


# Explicitly mount swap volume
mount -t hfs /dev/disk0s10 /Volumes/SWAP

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

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

dynamic_pager -H 40000000 -L 160000000 -S 80000000 -F ${swapdir}/swapfile

# Start daemon to fix incorrectly-prebound binaries
if [ -x /usr/libexec/fix_prebinding ]; then

Before changing your /etc/rc file to match run df to see how you system normally mounts the drives. I suggest rebooting several times to see if the mount points change.

I always boot to single-user and check that the drives mounted "correctly". This isn't a problem as I reboot for installs only (almost never any other time). Do your fsck -y AND fsck_hfs -y /dev/disk0s9 (use the up arrow for history and edit to fsck_hfs -y /dev/disk0s10 etc...

Exit to continue to login screen.

Should work on your G3 (assuming no SCSI problems)


12-02-2002, 05:55 PM
Thank you for your input. Where then can I read about how to switch the swap file for 10.2. I've never done it before.


12-02-2002, 08:08 PM

Just create the partition and name it SWAP.


type df <return> in the terminal

Note the mount point.

Mine is /dev/disk0s10 and /Volumes/SWAP

Reboot several times to discover the "normal" mount point as it WILL change.

In the terminal type (makeing sure of the spaces)

sudo cp /etc/rc /etc/rc.old

sudo pico /etc/rc

Edit the file so the above posted section looks simular to mine using YOUR values from df.

then <ctrl> + O (command to write Out the file changes)

a <return> to accept the filename

then <ctrl> + X (command to exit pico)

Reboot to single user mode hold <CMD> + S after the startup chime till text scrolls on the screen.

do the fsck stuff checking that the mount points look ok!(if not either reboot or edit the /etc/rc file to reflect the change ie. mount -uw / and then pico /etc/rc. You don't use sudo in s-u mode as you ARE ROOT be carefull)

then type exit<return> to go on to the login screen.

Others may use different methods with fstab or automount

If you are not comfortable with this as with ANY mods to system files don't do it till you understand and are ok with the consequences.


ps you can search the forums for "swap"

12-02-2002, 09:12 PM

putting the swap partition on the same drive as the system certainly doesn't slow things down.

that's bad advice.

12-02-2002, 09:50 PM

Not worth the bother. As some don't believe swap on a different drive makes any difference either. "Better to just get more RAM"

The thrashing depends on how many partitions, platters, heads, interleave, and possibly fragmentation. Probably just as much chance for thrashing with the standard swap. Its just if you want to see improved response subjective or otherwise a separate drive is the way to go.

So as I see it with only one drive its six for one and a half dozen for the other.

I apologize if my opinion looked too much like a given fact.