"swap" partition

It has been very often that my 1GB free goes to zero just by using applications and then the whole OS begins to hang, becoming slow.

So I just want to make sure there's enough disk space for temp files and figured making a partition for it might be a good idea.

So, is it a good idea? How can I make this partition? Should it be /tmp or something?

Is there such a standard value so I can set up a "swap" partition for things like sleep file and those things?

Background
I don't want to make it / and set a different for data, because apps and system are mostly unpredictable. I don't want to have TOO much space reserved and not being used, because my whole hard disk is already small enough.

I think this should be default on the Mac OS, and it should create a file or something for all its needs on creating temp files or whatever it does there. So I'll probably use this solution regardless of future hard drives I will get.

But if you must know, I've got a small hard disk and I will have to stick with this 160 GB for couple months. I've halved it to a bak partition, where I set the Time Machine. Actually, 90 GB for TM. So I got 70 for everything else. About 40 GB goes to music, which is not backed up.

That leaves about 30 GB for everything on my mac, including system files, applications, everything.

macbook pro, Mac OS X (10.6.2), <3 *nix

Posted on Feb 10, 2010 2:31 PM

Reply
20 replies

Feb 10, 2010 3:06 PM in response to Cawas

OS X does not require a swap partition. In fact were you to make one on the same hard drive as the system it will cause an overall reduction in performance. Furthermore, if you don't have adequate free space now, then you don't have space on the drive to create a swap partition.

What you really need is a large enough hard drive on which you can maintain at least 10 GBs or 10% of the hard drive's capacity free, whichever is greater. This should be adequate.

If you cannot replace your hard drive then get an external hard drive on which you can put your data files, and then remove them from your startup volume.

There are no defaults in OS X for using a swap partition or other volume for temp files, logs, VM, etc. OS X uses the system volume on which you need to maintain enough free space.

Also, you should not use a partition on your system drive as the backup for the system volume. If the drive fails then you have no boot volume and no backup. Backups should always be made to a separate drive. Get a backup drive then you'll have plenty of space on your startup drive.

Feb 10, 2010 4:01 PM in response to Cawas

Using the same disk for backup? not good idea.
Also, it is very wearing, slow, as it reads and writes, going back and forth betweeen partitions. Use external.

And what happens if the drive fails?

A small 20GB emergency boot volume can be handy, just not TimeMachine or backups.

Take a look, there are 'kits' with new drive and empty case for your old drive.
http://www.macsales.com/firewire

Feb 10, 2010 4:53 PM in response to Cawas

Cawas wrote:
It has been very often that my 1GB free goes to zero just by using applications and then the whole OS begins to hang, becoming slow.


This is the problem you need to focus on, but as others have said, your proposed solution is not a good one -- it will just make things worse.

Several bits of info will help us understand the cause of your issue better. First, do you really mean that free memory literally goes to zero, or just to some very small number, say a few 10's of MB's? It should never go all the way to zero -- if it does something is very wrong with your system.

Next, how much free space is there now on your 70 GB startup partition? If this number is very small, OS X can't function properly (you got that much right), but the only viable solution is to immediately free up some space by moving files off the partition. Aim for at least 5 to 10 GB free. If necessary, buy a stack of CD's or DVD's & burn user documents to them.

A good candidate for this is your iTunes music library: Launch iTunes & select its File menu > Library > "Back Up to disc …" item. For more about this, see the "Backing up your iTunes library and iTunes Store purchases" iTunes help topic. *You need to do this ASAP* (or at least backup to another hard disk drive if you can currently afford that) -- as things stand now you have no backup of your 40 GB of music, which means *you could lose it all* if something goes wrong with your Mac or its HD.

Feb 11, 2010 6:42 AM in response to Cawas

Haha, I freaking knew it!

First of all, thanks for all your worries and sorry if I couldn't make myself clear at first. But I know all that. Don't think "out of the box" too much here, it's simple.

Important data I always have replicated elsewhere, in many different places. Please don't worry about my backups. I like TM in the same disk as a resource, not as backup, mainly.

This is a situation I have while I still can't buy any kind of another hard disk. I just went to a store here in Brazil (fnac): a 320GB external Iomega would cost me $300 that I just don't have right now and a size I don't want external - I'll get at least 1TB and at least 320 inside the mbp. Even if I have an external backup of, let's say, 10TB, eventually I will fill it up and very often I do get a full disk ANYWAY.

I just want to be sure the system will not suffer from that.

As for "is this a good idea" I wasn't hoping to get suggestions to "just buy more space", I was hoping to get suggestions such as "no need to, just tweak OSX configurations so it will create swap files" or something in those lines. I thought I made it clear I couldn't get more space, but I forgot to make it clear that even if I had more space I would fill it up. I love to use all my space, I don't like having free space.

I have 1GB and if I open too much stuff it will go to zero, not 10 MB, not 1 KB, but ZERO! The system is brand new and I did almost no tweak on it except installing some apps such as NTFS for Mac, Dasher, BlueHarvest, BetterTouchTool, etc.

I know that freeing up space is the best choice, and that's exactly what I want to do. But I want to also restrict it somehow to always keep the enough free space to keep OS working. That's all! I figured that's the first use partitions had - restrict space on disks - but that's also why I'm not sure it would be the best way to do it.

C'mon people, don't get me the wrong way. 🙂

R C-R wrote:
Aim for at least 5 to 10 GB free

That tells me Mac OSX actually use over 15GB rather than 5. That's the first thing I want to know. The second is how I could partition it, and I hope iPartition can do the job. Or I'll get gparted for it. I just don't want to have to worry on how much free space to leave - it should be restricted to keep it for the system keep working fine.

Kappy wrote:
What you really need is a large enough hard drive on which you can maintain at least 10 GBs or 10% of the hard drive's capacity free, whichever is greater. This should be adequate.

Ok, I over-read this at first. 10%, that's pretty the specific number I wanted to know. Now, just need a method on how to automate and always have that 10% free. No, I don't want to keep an eye on it, thanks.

The hatter wrote:
A small 20GB emergency boot volume can be handy, just not TimeMachine or backups.

As a different subject, that's something I will look into! Can you give me more pointers on this?

Message was edited by: Cawas - trying to make it better

Feb 11, 2010 7:04 AM in response to Cawas

Mac HFS file system doesn't like to get to 10% free space.
The directory can disappear.

You may have seen Windows put RED icon on a drive with low space, well, this is e even worse.

The best tweak is no tweak at all.

Once you have 20GB extra space to waste, and you aren't busy counting bits, shrink and create an emergency boot volume and install Mac OS. External is best but laptop road warriors may want it on their internal hard drive.

No Amazon (online shopping, not forest)? They have 1.5TB WD Green for US$109. Just add a working USB2 case (can't wait for USB3). Just one thing: stay away from name brand disk cases.

Apple ships with minimal RAM, otherwise, Mac users and OS X avoid paging and swap like the plague. And, Snow Leopard does cause low memory situations. My Windows 7 systems don't let memory sit idle and go to waste and will cache and 'use' it to improve performance, but 1GB on a modern OS is what I call the "Starvation Diet" that no OS should be on.

Then let Mac OS do its best to organize and optimize. I would save my money on iPartition. And I'd do a full backup, erase, and restore.

Try using Disk Utility Restore. Also, get familiar if you aren't with creating DMG images, you can use sparse disk images, and create one for minimal system, another for data.

SuperDuper does a smart restore that doubles as my disk optimizing and defrag (consolidate free space into one chunk and put directories in order).

I put a 10GB file first, then when the restore is done, delete, and then allow files to 'migrate' to the top and let Mac OS hot zone and organization that it does fine - on its own, with most accessed files etc.

Feb 11, 2010 7:26 AM in response to The hatter

The hatter wrote:
Mac HFS file system doesn't like to get to 10% free space.
The directory can disappear.


What that means?!

You may have seen Windows put RED icon on a drive with low space, well, this is e even worse.


Never seem it. :P

The best tweak is no tweak at all.


I'd love that, but that's what I did first and then I got the problems.

Once you have 20GB extra space to waste, and you aren't busy counting bits, shrink and create an emergency boot volume and install Mac OS. External is best but laptop road warriors may want it on their internal hard drive.


If it's just emergency, can't I use the CD or set up 10GB? I was hoping for a link discussing on why doing this and options. 🙂

No Amazon (online shopping, not forest)? They have 1.5TB WD Green for US$109. Just add a working USB2 case (can't wait for USB3). Just one thing: stay away from name brand disk cases.


Well, USB case need AC power, right? I rather use firewire, get extra speed, no need to AC and leave usb ports free. Anyway, I suppose from previous attempts amazon won't ship here anything but books. China, at other hand... But I still rather wait little bit more and get a good overall solution with warranty, and that I can only get buying from stores in here.

Apple ships with minimal RAM, otherwise, Mac users and OS X avoid paging and swap like the plague. And, Snow Leopard does cause low memory situations. My Windows 7 systems don't let memory sit idle and go to waste and will cache and 'use' it to improve performance, but 1GB on a modern OS is what I call the "Starvation Diet" that no OS should be on.


Yeah, I'm not sure I should have used the term "swap" there. Certainly should have avoid "partition", mac people get mad with that word! :P

Then let Mac OS do its best to organize and optimize. I would save my money on iPartition. And I'd do a full backup, erase, and restore.

Try using Disk Utility Restore. Also, get familiar if you aren't with creating DMG images, you can use sparse disk images, and create one for minimal system, another for data.

SuperDuper does a smart restore that doubles as my disk optimizing and defrag (consolidate free space into one chunk and put directories in order).

I put a 10GB file first, then when the restore is done, delete, and then allow files to 'migrate' to the top and let Mac OS hot zone and organization that it does fine - on its own, with most accessed files etc.


DMG, huh? That's a kind of idea I'm talking. Now, can I make a DMG and point OSX to use it for its temp files and swap needs?

Feb 11, 2010 8:05 AM in response to Cawas

Because your initial post is very long, I had difficulty reading the actual, basic question. But I assume you want to put your swap file on a dedicated partition.

It can be done, but I doubt it's worth it.

First, you'll have to create a separate partition:
http://superuser.com/questions/63478/snow-leopard-clean-install-on-partition-and -resize-later

Then, you'll have to configure Snow Leopard to write its swap files to the new partition:
http://superuser.com/questions/28414/moving-the-swapfiles-to-a-dedicated-partiti on-in-snow-leopard

Note: I haven't tried this, just did a couple of searches on superuser.com. Good luck.

Feb 11, 2010 8:35 AM in response to Cawas

I was hoping to get suggestions such as "no need to, just tweak OSX configurations so it will create swap files" or something in those lines.


No tweaking needed -- or advisable. The OS already creates swap files as needed, using a fairly sophisticated algorithm that minimizes the amount of disk space required. You should not try to change this unless you have very extensive knowledge of the memory management system -- which, no offense intended, you obviously do not have or you would not be asking about this here.

I love to use all my space, I don't like having free space.


To be blunt, what you like doesn't matter. The OS must have free space on the drive to function properly. Period. If it doesn't, very bad things can occur, up to & including trashing the HD (& your data files along with it) badly enough that you will have to reformat it to recover.

That tells me Mac OSX actually use over 15GB rather than 5.


Nope. It isn't even close to that simple. The OS needs space for its own component files (some of which you see in /System/ or /Library/), for data reference files it creates, for various kinds of caches, for VM swap files, & for many different types of temporary files that are created & deleted as needed. This is why there is no way to say exactly how much free space will be needed, only rules of thumb for safe & unsafe amounts.

Now, just need a method on how to automate and always have that 10% free. No, I don't want to keep an eye on it, thanks.


The problem with this is there is no way to accurately predict how much space will be needed for the various items mentioned above. The OS will try to warn you when free space runs dangerously low, but this is not always possible. For instance, if this happens during a complex processing load, there may not be enough free disk space to swap out enough real memory to VM to run the notification process. Simply put, when everything is filled up, there is no room to do anything more, & everything stops working, including updating files & the file system if that is in progress.

The only way around this is to allocate more space than any single process will need, for instance by dedicating an entire partition to swap files, large enough to accommodate every swap file the system might create. But since there is no real limit to this, even a very wasteful & generous allocation may not be enough.

Feb 11, 2010 9:10 AM in response to Cawas

Cawas wrote:
Maybe I should go and try to make a new question starting with this:
*How can I automatically hold free space to keep OSX running smoothly?*


You will just get the same kind of responses you got here. It isn't that we don't understand what you are asking. It is that there is no way to do this that makes *more efficient* use of the existing drive space than the OS does with the default "un-tweaked" configuration.

Yes, you can configure the OS to use different partitions for different things, but no configuration will use less total disk space (assuming you make the partitions large enough for what they must hold) than the default one. So, if you only have one drive & you want to make the best use of its space, don't partition it.

It's that simple.

Feb 11, 2010 12:17 PM in response to Charles E. Flynn

Storage systems with quota can limit how much of a volume can be used and avoid potential risk, and warn or alert the user. But such a feature has never been added or implemented in Mac Extended.

MicroMat had thousands of posts and hours of great advice over the years in MacFixit Forums section they ran, and a "free education" and freely offered to all who asked and wanted help and discussions.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

"swap" partition

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.