|
|
#1 |
|
Triple-A Player
Join Date: Aug 2002
Location: Yellville, AR
Posts: 52
|
need help Moving swap file under 10.2
I only have a 450MHz G4 Sawtooth at work, so I need every performance edge I can get. I enjoyed being able to move my swap files off the boot drive (IDE) to a separate disk (SCSI) in 10.1.x, but can't seem to get it to work in 10.2 - does anybody have any info on this?
I suspect the issue lies with the system looking for the swap directory before it actually mounts the SCSI or Firewire drive, but since I don't have a second IDE drive in that box, I can't test it. Currently, when I modify fstab and rc to mount and use /Volumes/swap (for example) I end up with a folder called swap that contains the swap files, but is actually on the boot drive. And the "swap" volume is mounted as "swap 1" in /Volumes. Under 10.1.x, this would happen after a warm reboot, but could be remedied by totally shutting down and doing a cold restart. But that doesn't work, anymore. This isn't a critical issue under Jag since it's so much faster, but I run a lot of big-gun graphics and development tools at the same time, and have already had a couple of incidents where my disk was thrashing and slowing me down, temporarily. Any insights into this will be greatly appreciated. |
|
|
|
|
|
#2 |
|
Major Leaguer
Join Date: Jan 2002
Location: Midwest Not quite Normal
Posts: 416
|
hmmm...
I added swapdir=/Volumes/SWAP/vm to rc but it didn't seem to take? Mount local filesystems is early in rc so this should work. I had to move it ahead of swapdir line in 10.1. Will investigate further. Willy |
|
|
|
|
|
#3 |
|
Triple-A Player
Join Date: Aug 2002
Location: Yellville, AR
Posts: 52
|
I've been fiddling with it off and on, and I think it has to do with the fact that fstab no longer works. So when rc tries to put the swap file on /Volumes/swap, there isn't a drive there, so it ends up making a "swap" directory, and putting a "vm" directory in it, and putting the swapfile there. And all of this is actually on the boot drive.
Since there already is a /Volumes/swap in existence, when it's time to mount the disk, the OS adds the real swap drive as /Volumes/swap 1 The trick is to get the drive mounted before rc lays down the swapfile to disk. The only way I knew to do this, before, was with fstab. What's the new way? Is it something in NetInfo? |
|
|
|
|
|
#4 |
|
All Star
Join Date: Feb 2002
Location: peteyville
Posts: 794
|
you need an explicit mount call
here's the code in my rc file. obviously, you need to change the volume location as to where the disk or partition is on your machine (it's 'disk0s9' on mine.)
it works for me under 10.2 --- ConsoleMessage "Starting virtual memory" mount -t hfs /dev/disk0s9 /Volumes/Swap swapdir=/Volumes/Swap/vm |
|
|
|
|
|
#5 |
|
Triple-A Player
Join Date: Aug 2002
Location: Yellville, AR
Posts: 52
|
Is that the only change you made? Adding the "mount" line in rc?
It's still not working for me. I wonder if it's because I don't have a second IDE drive or volume. Just a SCSI drive (on a PCI card) and an external FireWire Drive. I've been able to move swap files to these under 10.0.x and 10.1.x, but not now, for some reason. Still the same symptoms. Maybe I need to get a small IDE drive for a swap drive. |
|
|
|
|
|
#6 |
|
Major Leaguer
Join Date: Jan 2002
Location: Midwest Not quite Normal
Posts: 416
|
petey
thanks, I'm seeing the mount local file systems things crash with a bus error but its scrolling by too fast to catch it all. Nice to have swap partition working again, even tho the new spinning lolipop looks pretty, I still don't want to see it. Willy |
|
|
|
|
|
#7 |
|
Triple-A Player
Join Date: Feb 2002
Location: Foster City, CA
Posts: 63
|
Sawp Cop?
Does Swap Cop not work under Jag? The developer's site doesn't say, unfortunately.
|
|
|
|
|
|
#8 |
|
Triple-A Player
Join Date: Aug 2002
Location: Yellville, AR
Posts: 52
|
I tried swap cop, too, but it's the same story.
I'll just try to find a spare IDE drive when I get back to the office, Tues., and see if I can get it to work with that. |
|
|
|
|
|
#9 |
|
Prospect
Join Date: Jan 2002
Location: new york city
Posts: 1
|
Petey had the answer
i was having the same dirty double mounting problem until i commented out the "/dev/disk0s9 /Volumes/swap hfs rw 1 2" line in my fstab file. that combined with petey's explicit mount solution, a reboot and all was good
you can check by opening the terminal and typing: ps -ax | grep dynamic_pager if all went well it should point to your swap partition |
|
|
|
|
|
#10 |
|
Prospect
Join Date: Jan 2002
Posts: 4
|
Interesting...
It looks like fstab is still used, it just had a different format of LABEL=Partition_Name /Mount_Point hfs rw 1 2 where Partition_Name is the name of the parition and Mount_Point is the location to be mounted. http://www.kung-foo.tv/blog/archives/000193.html This seems to work for moving the Users folder to a different parition, but I haven't had much luck with it and moving the swap file. I tired LABEL=Swap /private/var/vm hfs rw 1 2 but that didn't seem to work. The dynamic_pager is running but doesn't list a directory. Hope this helps with regards to moving the swap file without editing rc. skinlayers |
|
|
|
|
|
#11 |
|
Prospect
Join Date: Oct 2002
Location: Lymington
Posts: 3
|
moving swap in Jaguar
I have only just done this but this seems like the easiest way to move your swap file.
Forget about /etc/fstab Forget about editing the swapdir - leave it at /private/var/vm further up the rc:------------------------------------------------------- ## # Mount essential local filesystems (according to /etc/fstab). ## ConsoleMessage "Mounting local filesystems" mount -t hfs /dev/disk0s9 /private/var/vm mount -v -a -t hfs mount -v -a -t ufs mount -t fdesc -o union stdin /dev mkdir -p -m 0555 /.vol && chmod 0555 /.vol && mount_volfs /.vol -------------------------------------------------------------------------------- obviously my volume to mount is disk 0 slice 9 but this seems to work with a single drive... ... unless someone else knows better! |
|
|
|
|
|
#12 |
|
Triple-A Player
Join Date: Aug 2002
Location: Yellville, AR
Posts: 52
|
I know how to do it, now.
It's easiest to do this in BBEdit, or some other GUI text editor that will not alter the nature of the file. (Make sure BBEdit is set to save it as a UNIX file, not a mac file.) Log into the finder as root, then open /etc/rc move the "Start the virtual memory system" part to the end of the file, after the "start system services" section. Add a "mount -a" line right before the line that points to your swap file. Then alter that swap file line to point to the new location for your swap file. Reboot. Here's the new end of my rc file: ## # Start System Services ## # Set language from CDIS.custom - assumes this is parse-able by sh . /var/log/CDIS.custom export LANGUAGE SystemStarter -g ${VerboseFlag} ${SafeBoot} ## # Start the virtual memory system. ## ConsoleMessage "Starting virtual memory" mount -a #swapdir=/private/var/vm swapdir=/Volumes/Swap/vm if [ "${netboot}" = "1" ]; then sh /etc/rc.netboot setup_vm ${swapdir} fi # 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 dynamic_pager -H 40000000 -L 160000000 -S 80000000 -F ${swapdir}/swapfile exit 0 |
|
|
|
|
|
#13 |
|
Triple-A Player
Join Date: Jan 2002
Posts: 63
|
Another... Better(?)... Answer
Hi.
>> move the "Start the virtual memory system" >> part to the end of the file, after the "start >> system services" section. This solution could be a bit sketchy because some of those system services may need virtual memory! (Note the "may" in that sentence.) I *believe* the solution is that the external disc needs to be marked clean before its mounted. A plain mount will fail if the disk isn't flagged as clean, hence the (correct) fstab and mount additions not working. The way I do it is to call Apple's autodiskmount utilitiy which "does all the right stuff" to mount a disk.... Including fsck to mark the disk clean if necessary. Replace Line 178, which reads... swapdir=/private/var/vm with the follwoing: /sbin/autodiskmount swapdir=/Volumes/Swap/private/var/vm This works without an /etc/fstab for me, but I am working with a local disc. You may need to add an entry for your disc (in the new format, as discussed previously). If this works, I would consider it safer than moving everything below "start system services." Good luck. -Pie |
|
|
|
|
|
#14 |
|
All Star
Join Date: Feb 2002
Location: peteyville
Posts: 794
|
9killer is correct
moving the "Start the virtual memory system" section to the end of the RC file is a GOOD thing.
--- before i moved the code, using an explicit mount call, the swap would land in the right place about half the restarts. since moving the VM code to the end of the RC file, it works 100% of the time for me. |
|
|
|
|
|
#15 |
|
Triple-A Player
Join Date: Aug 2002
Location: Yellville, AR
Posts: 52
|
yeah, my version is based on a tip I saw on the regular macosxhints site. Do a search for "swap" and you'll see the post in question. The guy who figured it out wasn't 100% sure what he did that got to work, but posted all the things he tried. I simply tested it a bit, and refined it down to the necessary parts.
But, I'm am by no means an expert. I could easily be doing something detrimental, and not be aware of it. |
|
|
|
|
|
#16 |
|
Triple-A Player
Join Date: Jan 2002
Posts: 63
|
Danger Will Robinson....!!!
The SystemStarter is used to crank up services that are installed in /System/Library/StartupItems. Many of those things will eventually be swapped... and may
need to be at startup! Startup swapping will depend on how much is actually fired up by SystemStarter (it's controlled by various Prefs panes and system config files). If, for example, you have a 50GB database started with only 128 megs of RAM... well I'd be throwing money down on a swap occuring early on! I betchya you don't, but there is some cut-off where a swap will occur, even during startup, and it's not very easy to say if/when/where it will happen! So I want to reiterate that moving the Swap startup below that section in /etc/rc is a risky proposition indeed. Or maybe a better way to put it is this... Did Apple/Darwin Developers put the swap code before SystemStartup for a reason? Now a bit of clarification on the /etc/rc addition I suggested... Note that in my posted code I am not calling mount, but "autodiskmount", which is sortof a *supermount*. It ultimately performs the same task as mount, but *after* a variety of sanity checks. So that's why autodiskmount works where mount fails. Whether this will actually work on an external disk... Unfortunately, I can't say because I am dealing with partitions on a local drive for my Swap. Maybe you can give it a shot. It's certainly no more risky than what you've already done. And I'd certainly like to know if I'm barkin up the wrong tree! -Pie |
|
|
|
|
|
#17 |
|
Major Leaguer
Join Date: Jan 2002
Location: Midwest Not quite Normal
Posts: 416
|
I like to see my swapfile
I use an explicit mount for the volume like this:
Code:
# Explicitly mount swap volume
mount -t hfs /dev/disk0s10 /Volumes/SWAP
swapdir=/Volumes/SWAP/vm
if [ "${netboot}" = "1" ]; then
sh /etc/rc.netboot setup_vm ${swapdir}
fi
After I'm logged in I check the date on the swapfile. To get a fairly reliable mountpoint you should BEFORE editing /etc/re, reboot about 5 or 6 times and do a df each time and record how your swap partition gets mounted. About one in ten times mine comes up /dev/disk1s10. So if you used the rare occurance to set up the swap it won't work most of the time. Checking all the volumes at reboot is not much of a problem as the system has been up 10+ days at the moment. Only reboot for installers. Too bad 'shutdown now' is broken. Willy |
|
|
|
|
|
#18 |
|
Prospect
Join Date: Nov 2002
Posts: 1
|
I found that using the rc file alone with the explicit mount command right before the swapdir = line made it so the df -k showed the /Volumes/swap directory as being swap and not swap 1 and when doing the check mentioned earlier in the posts to see if swap was being used on the right partition it shows up there. I tried the /sbin/auto and found I was getting the swap 1 problem in the Volumes folder. This is in 10.2.
Ignore this post, I check and after a few restarts the swap partition was showing up as swap 1 again :P
__________________
-Brian Last edited by Homer72; 11-06-2002 at 09:54 PM. |
|
|
|
|
|
#19 |
|
All Star
Join Date: Feb 2002
Location: peteyville
Posts: 794
|
this combo should work...
homer72,
exactly. i had the same experience. from that point, moving the relevant section of the RC file to the end made it work 100% for me. |
|
|
|
![]() |
|
|