The Authoritative Partitioning Discussion

mr. k

Registered
Well. In anticipation of getting panther (and it looks like I'm also gonna get a 40GB firewire HD too) I want to do everything it takes to optimize my aging iMac and keep all my data safe. I've been reading up on partitioning - and among the 50 threads here about partitioning at least 20 of them just ask if you can partition your drive without wiping the data on it. Most of the other threads aren't too helpful, and after some googling and a search over at macosxhints.com I figured I would come here to try and get a consensus.
Of all the reasons to partition a disk the reason I find most compelling is separating the system from my applications and users, so I can overwrite the system without copying my data all over the place next time I need to install a new OS. Another advantage looks like creating a swap drive, which is covered in an article at resexcellence.com.
I was thinking about creating three partitions --
  • System (5GB)
  • Data (34GB)
  • Swap (1GB)
I don't do much video editing, nor do I photoshop outrageously large images, so I don't believe I would need a scratch drive, and don't want to go crazy with partitions and have one for each users and applications and documents and developer...
But because I will probably have to live with this computer until I go off to college and I don't want to have to mess with is all the time I just want to create the best scenario now. I wanted to get some feedback on how big the system partition should be, if all it will actually hold is /System and /Library. I think I will set fink up on the Data partition, and just link it to the / directory for simplicity.
 
Well I would go...

System 7gb
Data1... your choices
Data2.... same
Swap/ downloads 5gb

I like to have more than one place to store data just in case i have a partition crash, I know I SHOULD have saved a copy to a back-up partition. And i like to keep anything i download away from my work files, because if i lose the downloads, who cares, I can download them again, losing work is a major set back.

I have 6 partitions over 3 hard drives.

System - 7gb
OS 9 and X apps - 6.5
Scratch Bin - 15
Data - 15
Data 2 - 12
Backup - 10

I have had problems where i lost a partition, but salvaged data to another partition. I keep all my apps that are not installed with the OS off the system partition, after reinstalls... my apps are already in place and ready to go. i also have a backup disc image of these apps on Data2, just in case my OS9 partition goes down, which it recently did, so that worked out great.
 
I have a slightly simpler setup, which will chage soon when I get a new 80/100/120 gig drive.
I have a 20Gb drive split into 1gb for my Home dir, (this could be used for multiple users if need be) and the rest for the system and apps (if the system is reinstalled, it's often helpful to reinstall your apps as well) and i also have a 40 gb drive which is currently used just for other data, like music (25 gb is too much for home drive) music videos, web sites for people, downloaded installers and updates, stuff like that.

Once i have the new drive, I'm going to simplify it to 20Gb Drive, unpartitioned: System, Applications, etc. (everything except MY Home basically)
80/100/120Gb Drive, unpartitioned: My Home drive, with all music, videos, work files, installers, etc.
40Gb: probably used for emergency or backup space.
I used to use a small partition on a seperate drive for a swap drive, but after a re-install of the system, i decided it really wasn't worth the hassle on my system. you may find greater speed increases, but it only really helps when it's on a different drive and i wouldn't suggest putting either your system or swap drive on a firewire drive.
 
Mr K

Don't go by the article at resexcellence.com. It is way out dated. Panther defrags automatically.

You can't repartition a drive without reformatting.

If I were you, I would use the enitre new drive without partitioning, for Panther. There's no real advantage in what you'lll be doing, and I think you'll find the machine will seem a bit faster doing it this way.

I would use CCC to clone this new Panther drive to the exisitng drive for an exact backup, incase of problems.

When the time comes that you will want to install a new system, you'll have everything on the bacjkup drive, just incase you decide to wipe the main drive for a clean install. You can move back things from that drive. Just make sure to use CCC every couple of weeks to have a current backup.
 
I have Panther disk (17Gb) and Classic disk (2Gb or so).
This works quite well, although I'm planning to abandon Classic if I can have Unreal Tournament running fast enough in Panther.
 
OK, what I really wanted to know was if it's better to partition the drive if all I'm gonna do is use some cute tricks to trick the system into looking like it's got the default tree structure (/users even though users is at /volumes/data/users, /applications at /volumes/data/application...). I can see where it would be useful, you could overwrite the system partition without backing up and copying over the data partition. But is bobw right? Is it really worth it to break the disk up into partitions? Does it take more time then it's worth?
Right now I'm leaning toward partitioning it as above. And bob - I thought that the whole point of the swap disk was so things that were supposed to happen in memory but couldn't fit into your available ram were written to a somewhat random sector of your hard disk which was slow, and could cause minor fragmentation. And why let the fragmentation happen in the first place, when you can prevent it?
 
Yea you will need to reformat, can't get around that. It is easy and takes virtually no time to setup. As simple as selecting the number of partitions and setting their sizes.

I believe it is worth it for the reasons i noted. As far as the swap files, I don't worry about those, because my system partition has more than enough room. i use the scratch bin for scratch disc space # 1, then my others as 2nd and 3rd discs for scratch.

I have a lot of memory, something i was told at my first professional job, you can never have enough memory, and that still holds true to this day. So i rarely swap out, unless i have a lot of Apps open that are using up a lot of my resources.

Long story short, I would make that system partition a bit larger, just in case you need that extra space, basically breathing room for the system to write data freely as needed in a wide space, than a small space where it needs to jump all over to save this data.
 
Yeah, I've really been thinking about getting more ram for the iMac, I never do anything that requires a drastic amount of ram, but replacing one of the 128mb dimms with a 512mb dimm would take about $80 by my quick estimate. Worth it probably, but it's not really up to me because it's not my computer.
I will probably end up going with something simple like two partitions, the 5gb system and then a 35gb other partition.
 
Mr K
Thought this might interest you;

From;
http://www.macosxhints.com/article.php?story=20010613140025184&query=pageouts


I collected the following illuminative posts from Barry Sharp on system memory management from the Apple discussion boards.

- Dennis Hill

[Editor's note: Dennis suggested I cut this down to a concise summary, but I thought I'd just publish them as they were written by Barry; he obviously has a great deal of knowledge about Mac OS X! These emails were originally sent by Barry to Ted Landau at MacFixIt, and then were posted to the discussion group where Dennis found them. So if you'd like to learn a lot more about OS X's usage of memory, read the rest of this article. It's a bit long, and can get technical at times, but I found it very interesting.]


--------------Email-1

Ted:

Virtual memory (VM) is just what it says -- "virtual" -- it really doesn't exist. The VM size is NOT consuming any disk space.

Unless a user's X system is performing swapping there's absolutely no need to worry about the swap file size nor its location. Swapping activity is provided by observing the "0(0) pageouts" in the last header line of the Terminal top command. Another useful Terminal command is the vm_stat(1) command (see man vm_stat). This command also displays the number of pageouts. The pageout value is an indication that physical memory is being paged(swapped) to the swap file. This i/o is done in page chunks. A page chunk is 4096 bytes in size.

When physical memory is paged (swapped) to the swap file it is being done so because physical memory is being over-subscribed. The best solution for avoiding frequent over-subscription of physical memory is to have fewer Apps running at same time or install more physical memory. When physical memory becomes over-subscribed the OS will seek out inactive memory pages and copy them to the swap file in order to make room for the active memory pages -- which may have to be copied from the swap file back into physical memory.

Excessive and continuing swapping in a VM UNIX system is BAD and should be avoided at all costs. One has to have a swap file to deal with memory over-subscription.

If a user observes pageouts to be non-zero AND growing rapidly then more memory should be installed or else reduce the memory subscription by running less work in the machine at the same time.

Taking time and effort to place and configure the swap file is for the most part futile and is an attempt to hide the real problem of over subscribing physical memory.

Also, note that in a multi cpu system there's no real concern for swapping activity if while swapping is being done the CPUs are kept busy with other work. Swapping and CPU work can proceed simultaneously. Only when the CPUs run idle waiting for swapping in/out to complete is there a problem with swap performance. In this case placing swap file on a very high-speed device will be beneficial.

My advice for most home computer users of X is to leave the swap file placement and its config alone and concentrate on ensuring the machine has ample physical memory.

I've been in the supercomputing UNIX business a long time and this aspect of swap file placement and config has been well and truly discussed and the conclusions are as I mentioned above.

If a UNIX system employs non VM for memory management (that is, real memory) the issue of swapping is a different beast altogether. This is because when swapping memory out it has to be done in large contiguous chunks (not small pages of 4096 bytes). For this reason it's important that the swap file space on disk be a contiguous set of tracks/cylinders and if possible have a separate data path to avoid interefering with other user i/o activities.

Regards... Barry Sharp
================================================

---------Email-2

Ted:

After sending you my lost post on "Virtual Memory swapfiles and OS X performance" I had some further thoughts related to many people posting

a) no matter how much RAM I have installed the X system appears to need it all

and

b) the X system appears to perform better with increasing time of usage

Although I don't have the X kernel source code I can easily speculate why these statements are being made, and also why they are valid.

First, let's digress just for a moment back to 9.1. In 9.1 there were two configuration options that relate to what's going on in X.

They are the Disk Cache and the RAM Disk features.

The Disk Cache can default to some size or be overridden. This cache is used to hold frequently used disk data or data that simply is being written out to disk. The idea is for the data to be more readily available to Apps when they need it and so avoids data having to be read from disk. Memory-to-memory transfers are very much faster than disk-to-memory and vice versa. The important thing to note here is that this Disk Cache is static. Its size never changes. If you make it large it takes memory away from what's available for Apps. If it's made too small it is ineffective. There's also some danger in caching data in memory and that is, if the system crashes this data may have not made it to disk for safe keeping and recovery after the reboot.

The RAM Disk feature is similar in nature to the Disk Cache in that it's static and takes precious memory away from Apps that may need it. Its usefulness lays in the fact that some App need to reuse their data files repeatedly. If these data files all fit into the RAM Disk then great benefits can be obtained by avoiding the much slower disk data transfers.

In X neither of these features are present on the face of it.

However, X's underpinnings (ie the UN*X kernel) provide both these features without any inputs being needed by the user. It's called the file system buffer cache. The one most significant difference is that the size of this buffer cache is dynamic. It starts of with some small size and can grow and shrink as the i/o demands and Apps memory requirements vary over time.

It's called a 'buffer cache' because it buffers the i/o data on its way to/from the disk. When an App writes data it first will be deposited into the Apps file buffer memory region and will subsequently be requested via library routines to have the kernel (the OS) copy it from the App's buffer to disk. The kernel will oblige and will copy it first to its buffer -- the file system buffer cache. If the kernel requires more room in its buffer cache it will obtain it from the free memory. When this happens the free memory value, in say the Terminal's top command, will immediately show a reduction of free memory. At some later point the kernel will copy this data (referred to has dirty buffers) to the appropriate disk location. I believe the frequency of this being done is 30 secs -- called sync-ing to disk.

As the usage of X increases with time without rebooting the kernel file system buffer cache will fill with the most needed or most frequently used data. This should help explain why some people claim that the system appears to perform better the longer they've been running X. The needed data for doing things (or maybe most of it) is now all resident in memory (the kernel's buffer cache) and doesn't need to be read from disk. This is much much faster.

As mentioned above, the kernel will expand its buffer cache on demand by using the free or unused memory in the machine. This explains that with time (could be a short period of time or a long period of time -- it depends on system usage/workload) the system appears to be using all of the available RAM per the Terminal's top command.

One other point to make is that if the kernel's buffer cache has grown to be quite large and is consuming a large percentage of the installed RAM there's no harm being done. If a new App is launched the kernel will release as much its buffer cache as needed. First it will release parts of the buffer cache that aren't 'dirty' until it figures it can honor the new App's memory demand. If by releasing all the non-dirty buffer segments it still requires more memory for the App then it will start writing the dirty segments of the buffer cache to disk and releasing their memory which in turn can be given to the new App. This stops when all the memory required by the new App is satisfied. In this manner the kernel buffer cache shrinks down in size. There's probably a minimum size to which it will shrink down to. In this case the kernel will start looking for other memory that's inactive. This could be a dormant App's memory. In this case the kernel will start to page out the dormant App's memory hoping to satisfy the new App's memory requirements. This kernel activity is called paging or swapping.

When the kernel starts to perform swapping it's a sign that the physical memory in the machine has been oversubscribed. Continual swapping will impact the overall system performance -- things will become unresponsive and much disk i/o seeking will be apparent/heard. This type of activity is displayed in the Terminal's top command with the value immediately preceding the "pageouts". If this number is non-zero and increasing rapidly over short periods of time then severe swapping is taking place. This is bad.

If severe swapping is taking place then either more RAM must be installed or the workload in the machine needs to be reduced. Of course the system will continue to run but not at its optimal performance levels.

I believe the above helps explain why people claim the X system performs better over time without intervening reboots and why the system consumes all of memory no matter how much RAM is installed.

A good example of seeing the kernel buffer cache in action is to use the Terminal App. In Terminal perform a copy of a large file. I chose to copy the swapfile as I know it's large (you'll need to be root in order to do this). Also it helps to have a second Terminal window active with the top command running.

localhost% cp /var/vm/swapfile0 ./bigfile

If top showed some 100MB of free memory prior to this copy you'll notice that the free memory falls rapidly to around 4-5MB. This is because the kernel has consumed just about all of the available free memory for its buffer cache.

Now remove the ./bigfile

localhost% rm ./bigfile

What happens in the top display -- well all of a sudden you should see free memory shoot way up. This is because the kernel no longer requires all that space in its buffer cache that's holding ./bigfile AND it doesn't need to write it out to disk BECAUSE you removed it.

So my advice is

a) don't be too worried about free memory being small in the top's display

b) keep an eye on pageouts and if increasing rapidly with time reduce machine's workload or add RAM if workload is a requirement.

c) Don't mess with relocating or sizing the swapfile -- an interesting exercise but really quite futile for the average Joe using X on iBooks, iMacs, etc. You simply should avoid severe swapping at all cost.

One last point -- I speculate that X attempts to always keep a small amount of free memory. I've never seen mine dip below 3MB. I believe this is for avoiding a memory deadlock situation whereby the kernel needs memory to perform a critical function and cannot page any memory out -- a nasty situation.

Some of he following is speculative on my part as I don't have OS X kernel source code nor have I performed any real hands-on experimentation. I leave it to you to figure whether in your case moving the swapfile to a specially configured HD or HD partition provides any benefit. I will offer some suggestions and opinions along the way though.

1. (FACT) Each time X boots it removes any of the swap file segments -- ie swapfile0, swapfile1, swapfile2, ...., swapfileN

2. (FACT) Each time X boots it will create a file /var/vm/swapfile0 that I understand to be 80MB in size.

3. (SPECULATIVE) When X creates the swapfile0 file it may or may not be forced to be contiguous on disk. If not then it will be scattered about on the HD (ie fragmented to a small or large degree -- depends on how fragmented the HD's free space is at the time.

4. (SPECULATIVE) I believe when X pages/swaps memory it does so using well-formed i/o and transfers data in 4096 byte chunks (called pages). The minimum allocation style for HFS+ is 4096 bytes. It's unclear whether X pages/swaps using multiple 4096 byte chunks in a single i/o request. If not, then paging/swapping is done transfering single 4096 byte chunks.

5. (FACT) If the kernel buffer cache has a series of 4096 byte chunks that all map to a single contiguous disk address range then paging/swapping this series of chunks will be much quicker if the kernel organises the series of 4096 byte chunks in the proper order and issues a single i/o request. The same would be true if the data were coming from disk to memory.

6. (FACT) Application's memory can be scattered throughout main memory (RAM) -- it's not necessarily contiguous.

7. (FACT) Many Applications share memory resident re-entrant code fragments with other Applications and or system support programs. Typically these code fragments never get paged/swapped out as they are in constant use.

8. (FACT) If X finds itself having to page-out/in (swapin/swapout) constantly to meet the users memory demands the system's responsiveness will go 'down the toilet' in a hurry.

This activity can be observed by monitoring pageouts in the top display.

A constant stream of pageouts and pageins is not good and means main memory has been oversubscribed. If this is unavoidable for some reason then if X pages out a series of contiguous 4096 byte chunks rather than many individual 4096 byte chunks then having a swapfile that's not fragmented (be it on the internal HD or not) provides some benefit. If on the other hand X always does its swapfile i/o in single 4096 byte chunks then it makes absolutely no difference if the swapfile is fragmented vs. not fragmented (ie a contiguous set of HD tracks/cylinders). However, this situation should be resolved by adding more RAM not by messing with swapfile placement.

Sooooo, if X does insist on having the swapfile0, swapfile1, etc be contiguous it matters not as to where its located -- on the internal HD, a separate internal HD partition, or a separate disk altogether.

On the other hand, if X doesn't insist on having the swapfile be contiguous then only when your system performs severe paging/swapping in/out will having it on a separate partition all by itself or a separate HD used exclusively for swapfile will there be any benefit. I suggest however, that if this is the case you either cut back on the amount of workload in the system or install additional physical memory (RAM) to gain the full performance potential of your system.

It's kinda like the conjestion on the freeways -- if the freeways are conjested the soln is to throttle back the number of cars entering the freeways (ie reduce the workload) or build wider or more freeways (ie install more RAM).

My guess is that when X creates the swapfile on your HD it does so in such a way as to make it contiguous. If this is correct there's absolutely no advantage in placing the swapfile elsewhere.

I will try to find time to explore this aspect of the X default placement of the swapfile(s) later and post back.

Hope this rather long-winded explanation helps some.

Regards... Barry Sharp

I'm speculating and basing my answers on my UNIX OS experiences.

PhysMem is just that -- physical memory -- your installed RAM.

1. Wired = memory allocated that shouldn't/can't be swapped/paged out (ie its locked into memory -- possibly portions of the OS code for example).

2. Active = allocated memory that has been accessed during last N seconds.

3. Inactive = allocated memory that hasn't been accessed during last N Secs (quite likely to be forst candidates for being swapped/paged out if memory being demanded).

4. Used = Wired + Active + Inactive

5. Free = memory that isn't allocated to any process or the kernel.

6. VM = Virtual Memory ( a fictictous amount of memory that represents a processes upper potential limit for its memory allocation or requirements -- very raely ever requested). I'm not sure what the + 44.0M represents.

Remember that the command top shows both instantaneous and historic data. The PhysMem line shows actuals at the time top makes its inquiry to the kernel whereas the pageins and pageouts display activities since the machine was booted. Sooooo at some previous point apparently, in your case, the system/kernel had to swap/pageout some memory in order to accommodate a memory request issued by a user or kernel process.

Hope that was brief enough and helps you understand things better.

Regards... Barry Sharp
 
This guy knows his stuff - that was a nice read. So swapfiles might and might not have any effect at all in os x :^). So I probably won't need it. Maybe I can get some memory. That would be a lot better then moving the swapfile evidently.
 
this is interesting,
but 1 have one question:
Next to plenty of RAM, you'll also need enough free hd-space.
I experienced a crash of osx once, resulting in the loss of a lot of data, which i think was caused by a full system-partition, many swapfiles and maybe not enough ram.
Would in this case a seperate swap-partition have prevented this crash?
 
if you run out of space for your swap to work with you will crash or become very slow

hence why i moved mine to another partition

my setup isnt too complicated

i have 3 partitions on one drive and 4 on the other, 2 total being scratch disks, one system, one work files, one misc stuff, one backups of programs and another for stuff (backups etc)

i also back up onto my ipod, and occasionally important stuff to a bunch of cds
 
Arri, do you have journaling enabled? If you're not using Panther, you probably don't. Journaling can help you recover data if you experience a crash; I suggest you download Tinkertool and check it out.
 
How to join two partition

I would like to know how to join two partition. I have MAC OS X has two partition.

Macintosh HD (43.0 GB) and Untitled (31.2 GB)

I would like to convert into one full partion only. Any step by step help will be higly appreciated.

Thank you

Qamarjrk
 
How to join two partition

I would like to know how to join two partition. I have MAC OS X has two partition.

Macintosh HD (43.0 GB) and Untitled (31.2 GB)

I would like to convert into one full partion only. Any step by step help will be higly appreciated.

Thank you
 
Back
Top