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


Click here to return to the 'Re: 10.3/4GB Swapfile Partition size?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Re: 10.3/4GB Swapfile Partition size?
Authored by: cyberflyer on Dec 30, '03 06:50:12PM

I'm breaking in and setting up a new Dual G5 with 4 GB of ram, a 72 Gig 10Krpm System/boot disk and a 250 Gig 7.2Krpm Swap/Users work disk.

Currently I'm thinking:

72 Gig Fast Boot Disk:

20 GB - OS X 10.3
10 GB - OS X Dev Tools
10 GB - OS Classic
32 GB - Scratch for Photoshop, 3D rendering etc.

250 Gig Work Disk:

10 GB - Swapfile Partition
20 GB - OS X 10.3 (backup clone)
10 GB - OS X Dev Tools (backup clone)
10 GB - OS Classic (backup clone)
190 GB - Users (work, tunes, etc.)

The plan is to redirect the user folders to the users partition and the swapfile to its partition and keep the OS, Apps and scratch disks on the high speed drive.

Then set up a cron file to periodically backup the current state of my fast drive to the work drive. Worst case my fast drive burns up I can operate from the work drive.

I'd REALLY love a critque of this scheme. I'm an experienced Mac user, but only just getting into the guts of OS X now that Panther is here.

One concern is the size of the swap file partition. I read that 500 Mb will do it but that is an old post for a 512 Kb ram system. Then I read that 5 Gb is needed, 10 GM is recommended to avoid overflow, but that's for a 1 GB ram set up and I already have 4 GB of ram and can reasonably expect to upgrade to 8 GB of ram in the future. Then I read that with enough ram, swapfiles don't get used.

Can anyone provide me with experience on this issue?

How big should a swapfile partition be for a 4 GB ram OS 10.5 system running on a dual 1.8 G5?

What am I about to do wrong that I don't realize?

Thanks in Advance.

Cy.



[ Reply to This | # ]
Re: 10.3/4GB Swapfile Partition size?
Authored by: EatingPie on Dec 30, '03 07:34:07PM

Wow this thread has really grown!

I can't comment on any real-world metrics beyond the 1GB RAM range (I really wish I could afford to!!). However, given my experience in Panther with swap, I would say you want 10GB swap per 1GB RAM. But I can't say for sure.!

I do, however want to comment on this...

... Then I read that with enough ram, swapfiles don't get used.

With Panther, this isn't true! I always have at least one swap file in Panther... but that's still not the whole story!

In my 1GB RAM/5GB Partition scheme, applications started crashing. BUT... my swap files themselves still had not reached 512 MB total! Yet VM use showed above 5GB using Activity Monitor! (Hence my apps dropping like flies.)

I'm not sure what's going on in the kernel, but you cannot depend on small swap files telling the whole story!!

Panther is a lot more persnickity about swap than Jaguar, so the best advice I can give is be careful, and make the biggest swap partition you can!!

---
-Pie


[ Reply to This | # ]

Re: Swapfile Partition/RAM size?
Authored by: cyberflyer on Dec 30, '03 10:01:49PM

> In my 1GB RAM/5GB Partition scheme, applications
> started crashing. BUT... my swap files themselves still
> had not reached 512 MB total! Yet VM use showed
> above 5GB using Activity Monitor! (Hence my apps
> dropping like flies.)

OK. This gives me the sensation that there is another parameter that needs to be adjusted in High RAM configurations. It seems that 512 MB of swap file space is generally plenty. The swapfiles run 80MB a piece, how many are you going to need at once?

Something else is making the apps crash, I suspect. 10MB of SwapDisk per 1 MB of RAM is overkill. The best older reccommendation I could find is 2:1 Disk:RAM.

If I install 4 GB of RAM, I'd need 40 GB of swap disk, which is, well, somehow excessive for 80 MB swap files when more RAM is supposed to reduce the amount of swapping VM bothers to do.

I bet there is another parameter in the Startup process that needs to be tweeked when you get up past 1 GB of RAM to smooth this problem out, but I'm not the guy to find it.

Anyone want to track this down?



My one gig Powerbook Pismo shows VM at:
VM: 4.68G + 77.5M 156(0) pageouts

My three (one gig is in the shop) Dual G5 shows VM at:
VM: 3.13G + 70.2M 0(0) pageouts



Cy.



[ Reply to This | # ]
Re: 10.3/4GB Swapfile Partition size?
Authored by: syzygies on Dec 31, '03 01:34:20AM

Most of my experience with virtual memory and swapping is with large math computations, a single process on Unix using more than physical memory. No matter how big swap is, the process starts seriously slogging when it starts swapping. We generally bail and find a bigger machine long before swap runs out. I've also had Apple hardware since 1980, but the Mac is Unix now, my swap intuitions finally apply.

A memory leak has a very different signature from a process that is page-thrashing. By its nature the unreclaimed leaking memory is never used again, the process careens along with NO performance hit until swap runs out, then splat.

No one has the patience to watch a page-thrashing process run out of swap. No one realizes anything is wrong, on the other hand, until a leaking process goes splat.

Add to this mix confirmed reports of memory leaks in 10.3, and I'd bet that anyone needing a swap 10x memory has a leak.

What is less painful to watch is two processes taking turns with physical memory, whose combined usage exceeds physical memory. This is the sort of thing a swap 2x memory is good for.



[ Reply to This | # ]
How to put swap on a different drive in Panther
Authored by: TigerKR on Jan 01, '04 11:31:06PM
I have a DP1.25 MDD tower.

It has a 2 bus SCSI card. Attached to the first SCSI bus are two drives. Attached to the second SCSI bus is one drive. There are no other SCSI drives in the tower, and there are no IDE drives in the tower (just two ATA optical drives - but that's irrelevant).

SCSI0:
•DriveA
•DriveB

SCSI1:
•DriveC

Here's the problem. When I first installed Panther, when I typed df in the terminal, the drives were ordered as such:

/dev/disk1s10 DriveA
/dev/disk2s10 DriveB
/dev/disk3s10 DriveC

Now, after a few days, they're ordered differently:

/dev/disk1s10 DriveA
/dev/disk2s10 DriveC
/dev/disk3s10 DriveB

This is a problem, because DriveB has my swap, and DriveC has my Users (properly set in netinfo).

In order to use DriveB for my swap, I thought that I had to add a line to my /etc/fstab file:

/dev/disk2s10 /Volumes/swap hfs rw 1 2

When the system decided (randomly) that it wanted to switch B and C, then /dev/disk2s10 pointed not to my swap, but to my users - and it mounted my users as the swap! Not only that, but it recreated a new /Users folder! Then it mounted swap as "swap 1".

I had to fix everything, and I was concerned that it would flip-flop again (randomly).

And in fact, from this discussion :

>Using fstab for moving the swap is a bad idea.
>You have absolutely no assurance that what was
>/dev/disk1s2 (for example) one day will still
>be /dev/disk1s2 the next time you boot.

In other words, from this discussion :

>Character device description files (such as
>/dev/rdisk0s10) are created at boot time and
>do not survive a shutdown. Unless the boot
>volume is a CD, disk0 should contain the boot
>volume, but all other numbers cannot be assumed
>to remain stable.

A lot of people suggested that I use LABEL or UUID in /etc/fstab . But that wouldn't work because autodiskmount is supposedly loaded after VM.

Anyway, I think that I found the answer to the problem. Apparently, Panther doesn't mount non-IDE drives until the user logs in (and then unmounts them when the user logs out). This not only has implications for swap, but also being able to ssh into a computer where there is no user logged in.

You're going to need to have a swap partition formatted and ready to go, then edit /etc/rc with sudo. Here's the code to stick into your /etc/rc file. After it says "swapdir=/private/var/vm" paste this (this is a slightly altered version of syzygies code - which is linked above):

#------------------------------------- below inserted locally
newswap=/Volumes/swap
oldswapdir=${swapdir}

if [ ! -d ${newswap}/.Trashes ]; then
	swapcount=1
	ConsoleMessage "Waiting for ${newswap} to mount"
	while [ "$swapcount" -le 30 ]; do
		sleep 1
		if [ -d ${newswap}/.Trashes ]; then
			ConsoleMessage "${newswap} mounted after $swapcount seconds"
			break
		fi
		swapcount=`expr $swapcount + 1`
	done
fi

if [ -d ${newswap}/.Trashes ]; then
	swapdir=${newswap}/.vm
	ConsoleMessage "Using ${newswap} for swapfile"
	if [ -f ${oldswapdir}/swapfile0 ]; then
		rm -rf ${oldswapdir}/swap*
    echo "Removing old swapfiles from ${oldswapdir}"
	fi
else
	ConsoleMessage "Unable to use ${newswap} for swapfile"
fi
#------------------------------------- above inserted locally


And then if you're using non-IDE drives for swap, in the terminal, type:

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true


There's no need to alter the /etc/fstab file.

References:

http://www.sciencequest.org/support/computers/mac/repair_topics/application_specific/osx/swapswapvm.html

http://www.macosxhints.com/article.php?story=20031104150206554

http://www.math.columbia.edu/~bayer/OSX/swapfile.html

http://discussions.info.apple.com/WebX?128@143.yzG8aPqmqaH.2@.599ea35e

http://www.macosxhints.com/article.php?story=20031103155828117

[ Reply to This | # ]