image
image

Go Back   macosx.com > Mac Help Forums > Mac OS X System & Mac Software

Reply
 
LinkBack Thread Tools
  #1  
Old April 9th, 2001, 10:08 PM
a1291762's Avatar
Registered User
 
Join Date: Apr 2001
Location: Australia
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
a1291762 is on a distinguished road
Exclamation

CAUTION! This involves reformatting your disk so be careful and back up your data. If this fries your HD then don't complain to me. You have been warned...

OS X uses dynamic paging (that horrible system that's in Windows95/98/ME) so a fragmented disk makes for very slow performance. With only 128MB RAM on my iMacDV (1999) and a 4GB HD, I run into this problem a lot.

Because OS X is also Unix, you can use a much more efficient paging system, One that's been around as long as Unix. Of course, it's a swap partition.

Unless you have a program like FWB harddisk toolkit, you'll have to re-initialize your HD to add a swap partition but it's definitely worth it.

After seting up a swap partition, I ran almost every app I could find in OS X and the system was still responsive. Normally after running 3 or 4 apps, my system gets a major case of HD chugging.

How to add a swap partition to OS X:
1. BACKUP YOUR DATA (This should be obvious)
2. Create partitions
I chose to have 1 HFS+ and 1 swap
OS 9's Drive Setup and OS X's Disk Utility (Run from the install CD) can both create swap partitions.
For Drive setup, create a partition of type Unix Swap
For Disk Utility, create a Unix partition and give it the name swap
*note I created my partitions with the graphical utility on the LinuxPPC 2000 Install CD. I know Drive Setup can create Unix swap partitions but I haven't tested if Disk Utility does it properly. For the technically minded, the swap partition must be of type Apple_UNIX_SVR2 and have the label "swap"
3. Initialize your HFS/HFS+ partitions.
I don't think this is nesecary if you use Drive Setup or Disk Utility. It was for me because LinuxPPC doesn't know how to format HFS+.
4. Install OS X (and OS 9 if you want it)
5. Bring up terminal
6. Become root
type "sudo csh" and then enter your password (this loads a shell as root without having to specifically enable the root account)
7. Edit the /etc/rc file
find the swap section
comment out all of it.
add the line "mount -vat swap"
- means mount all swap partitions in /etc/fstab
8. run pdisk /dev/disk? -dump
? is the disk number of your hd (probably 0)
record the number next to the swap partition
9. Edit or create /etc/fstab (it probably doesn't exist)
add a line like "/dev/disk?s?? none swap sw 0 0"
- ? is your disk.
- ?? is the number of the swap partition.
10. reboot.

I chose 200MB of swap but you might want more or less depending on how many programs you run.

If you keep running out of memory, you can re-enable dynamic paging (the bit in the /etc/rc file).

Unfortunately there's no way I can find to see if OS X is actually using the swap partition (other than opening heaps of apps and seeing if the HD chugs). the "top" command seems to report bogus values for VM (It said I had 1.5GB of VM but it should have reported 328MB)

Another advantage of this is that if you dual boot OS X and another Unix, you can share swap partitions.

If you don't understand what I was talking about, you probably shouldn't be trying this.

Link
Reply With Quote
  #2  
Old April 10th, 2001, 06:32 PM
a1291762's Avatar
Registered User
 
Join Date: Apr 2001
Location: Australia
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
a1291762 is on a distinguished road
D'oh, Crap, Bugger!!!

After running without dynamic paging for a day, I have realized that Mac OS X lacks a "swapon" command.

This is what lets the OS use the swap partition as VM.

If anyone tried this then I apologise.

IT DOES NOT WORK!

Sorry,
Link
Reply With Quote
  #3  
Old April 11th, 2001, 01:38 PM
yada yada yada ya
 
Join Date: Mar 2001
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
paulsomm is on a distinguished road
Angry Re: D'oh, Crap, Bugger!!!

Quote:
Originally posted by a1291762
After running without dynamic paging for a day, I have realized that Mac OS X lacks a "swapon" command.
I'm determined to make this work. As per http://www.google.com/search?q=cache...n+swapon&hl=en

Apple states:

Quote:
The swapon() call is not supported; macx_swapon() is the equivalent call from the Mach pager
This looks like a function or procedure to be called by a program, and not a program itself. Does anyone know what/how/if this can be used to enable swap space? It's obvious, as per http://macunix.com/darwin-src.html that the physical command (among many others) was omitted from Darwin.
Reply With Quote
  #4  
Old April 11th, 2001, 02:19 PM
yada yada yada ya
 
Join Date: Mar 2001
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
paulsomm is on a distinguished road
Talking well, a close alternative

Browsing the web has proven to be partially fruitless in terms of whether someone has figured out a swapon equiv. But, there is a suggest at:

http://www.macosxhints.com/article.p...01215021440138

Which is better than the default setup of OSX. The article shows how to move your swap file to a different drive. Since I'm on a powerbook, I'll probably just move it to the parittion I made for the A/UX Swap space.

Just thought folks may want to know about an alternative
Reply With Quote
  #5  
Old April 19th, 2001, 05:41 AM
Registered User
 
Join Date: Apr 2001
Location: Aberdeen, Scotland
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Toadstool is on a distinguished road
D'oh, Crap, Bugger!!!

I like the subject line.

Type: pstat -s

"swamode not implemented yet" (or something like that).


Does it cheese you off, that we have UNIX.....but only bits of it.

In some UNIX(s) swap is in /tmp (Solaris), it would have been a neat move to go that way, as mounting the filesystem /tmp can automatically bung swap there also. Maybe its implemented but we don't know it yet.

Why did APPLE go back to BSD when they had a
SYSTEM V (AUX) years ago? Which is where the "Apple_UNIX_SVR2" naming came from.

All a little strange.
__________________
G3 B&W 500MHz/768 MacOSX 10.1.2 (4GB external) & 9.2.2 (9GB internal).
iMac 500MHz/384 | iMac 233MHz/256 (IPnetRouter, AppleMailShare)
PowerMac 7500 | PowerMac 7100 | Performa 5400
Pentium 11 300mhz Mandrake Linux 8.1.
10/BASE-T Ethernet hubs * 2, home built cables, piece of cake and cheap (cents)

"Complex problems have simple, easy to understand wrong answers"
Reply With Quote
  #6  
Old April 19th, 2001, 02:46 PM
blb blb is offline
`'
 
Join Date: Apr 2001
Location: CO, USA
Posts: 651
Thanks: 0
Thanked 0 Times in 0 Posts
blb is on a distinguished road
dynamic_pager

It appears as if the program /sbin/dynamic_pager is the one which sets up swap. It looks like it runs constantly, a ps shows it running on my system right now:

dynamic_pager -H 40000000 -L 160000000 -S 80000000 -F /priv...

It's started from /etc/rc, and has the following argument list:

usage: dynamic_pager [-F filename] [-L low water alert trigger] [-H high water alert trigger] [-S file size] [-P priority]

and it looks like the default is /private/var/vm/swapfile0
Reply With Quote
  #7  
Old April 19th, 2001, 05:25 PM
yada yada yada ya
 
Join Date: Mar 2001
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
paulsomm is on a distinguished road
Re: dynamic_pager

Quote:
Originally posted by blb
usage: dynamic_pager [-F filename] [-L low water alert trigger] [-H high water alert trigger] [-S file size] [-P priority]

and it looks like the default is /private/var/vm/swapfile0
Unfortuantely it doesn't support swap partitions. It's rather stupid of Apple, really, to not at least include the support, even if it's off by default. It's not like they had to figure out how to it, I mean they're using NetBSD as their reference platform so they have access to all the code needed . . . sheez.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change SWAP Partition! How? Come in and see it! Alexandert Mac OS X System & Mac Software 5 May 8th, 2002 07:06 AM
Format a Partition From HFS+ to UFS isaac_ho Mac OS X System & Mac Software 4 September 20th, 2001 09:59 AM
Anyone know how to adjust the Vitual Memory Page Files? knighthawk Mac OS X System & Mac Software 10 September 8th, 2001 12:13 AM
How to hide a swap partition Zeus Mac OS X System & Mac Software 2 August 20th, 2001 11:12 AM
Swap Partition jdog Apple News, Rumors & Discussion 11 July 6th, 2001 03:20 PM


All times are GMT -5. The time now is 09:02 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.