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


It works | 38 comments | Create New Account
Click here to return to the 'It works' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
It works
Authored by: John on Dec 22, '00 09:40:03PM

Yes, I tried this. Just be careful that you enter the correct /dev/disk* value. ;-)



[ Reply to This | # ]
bug in rc script
Authored by: John on Dec 23, '00 12:19:25AM
The problem with the solution as presented above by robg is that, when the rc script detects that swapdir does not exist, it both mounts the disk and creates the directory. If the swapdir was on a previously umounted disk, then a new directory (with a number appended) gets created. The new directory is local on / and not on the desired physical drive. I worked around the problem by skipping steps 6. and 7. Instead just replace
swapdir=/private/var/vm # 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} else rm -rf ${swapdir}/swap* fi
with
swapdir=/disk-name/path_to_swap_directory # Make sure the swapfile exists, # first check existence # if not first make sure disk is mounted if [ ! -d ${swapdir} ]; then ConsoleMessage "mounting directories" mount -t hfs /dev/disk**** /disk-name mount -uw / fi # Make sure the swapfile exists, # if not, create directory since disk should be mouned if [ ! -d ${swapdir} ]; the ConsoleMessage "Creating default swap directory" mkdir -p -m 755 ${swapdir} chown root:wheel ${swapdir} else rm -rf ${swapdir}/swap* fi


[ Reply to This | # ]
Nice find...
Authored by: robg on Dec 23, '00 01:03:03AM

Thanks for finding the bug in the script! As I said at the end, I hadn't tried it myself yet due to
a lack of extra hard drive space (and hard drives in general!). Patpro (who wrote the how-to)
has said it was working fine on his machine, but I can see how your changes will make
it a safer script. Thanks again for the fix!



[ Reply to This | # ]
other swap options?
Authored by: Anonymous on Mar 25, '01 07:10:58PM

I've got 1G of ram. I want to create atleast 1.5G of swap area to have a total of 2.5G Vmem.

MacOS created by default a swap file in it's root filesystem. This is not what I want. I read about the way to move the swap file to another filesystem that can exist on a faster drive. This is also not what I want. My root filesytem is a 18G scsi.

What I want is for MacOSX to be able to do what other unix flavor can. Swap out to a device, or a raw partition rather than a swap file in a filesytem. From what I see, it's not possible, but since macosx is a unix derivative, it has to be some hidden feature. To swap to a raw partition has dramatic performace increase over to a file in a filesystem.

I've even pre-created 1.5G of raw space in start at the first block of my drive, also to help improve swap performace. But it's idle and reserved for now until I can find out how to use it. Can MacOSX do this? Linux can, Solaris can, IRIX can. OpenBSD, NetBSD, FreeBSD can. I will not believe that OSX can't.

Has anyone looked into this?

Also can a multiple swaps be used? From what I understand in the Unix world, when creating multiple swap area across different drives, the os stripes between them, dramatic improving the speed of read/write to it. I want to be able to explore to performace potential of osX. I'm sure you guys do too. Let's look into this!

Thanks!



[ Reply to This | # ]
other swap options?
Authored by: patpro on Apr 27, '01 07:27:58AM

you may want to take a look at : http://www.peak.org/~luomat/articles/FAQs/Swapfile_Swapdisk/

As swap system of OSX is inherited from the Next's one, these readings are very informative. I based my own research on these docs to find out the way to move swapfiles.



[ Reply to This | # ]
other swap options?
Authored by: chabig on Dec 26, '01 11:55:42AM

If you've got 1GB of physical RAM, congratulations! You're doing the best you can to manage your memory.

The OS X virtual memory system only pages memory to disk when it's necessary. It doesn't reserve disk space in advance, rather it grabs 80MB chunks of disk space only when they're needed.

Chances are, with your 1GB of RAM, you never have any memory paged to disk. When you use all of your RAM and the first 4096 KB chunk gets paged to disk, it will go to an 80MB swapfile. If you task the system so hard that that file is all used up, OS X will create another 80MB swapfile, etc.

You shouldn't think "I want 2.5 GB of virtual memory." In fact, you've already got that, and more--up to the capacity of your hard disk. Got 5 gigs free on your hard drive--congratulations, you've got 6 GB of virtual memory! Got 10 gigs free, you've got 11 GB of virtual memory!



[ Reply to This | # ]
other swap options?
Authored by: patpro on Jan 02, '02 04:41:22AM

I don't agree with your statement saying that "Chances are, with your 1GB of RAM, you never have any memory paged to disk".

I have 640 MB RAM (ok, not 1GB) but I still managed to create about 10 swap files (76,3 MB each) just by opening a 15 or 16MB JPEG with preview.app. other app running were : IE, ircle, finder.app, dock.app, terminal.app, that's all.

So I would say, chances are with 1GB of RAM you will have memory paged to disk sooner or later.

note that OS9 can open the same JPEG and even a 32MB JPEG without virtual memory, and it does it really faster than preview.app on OSX



[ Reply to This | # ]