Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!clyde.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!think.com!mintaka!mit-eddie!media-lab!lacsap From: lacsap@plethora.media.mit.edu (Pascal Chesnais) Newsgroups: comp.sys.next Subject: Re: Build an external disk as boot disk with 2.0 Message-ID: <5160@media-lab.MEDIA.MIT.EDU> Date: 8 Feb 91 14:05:42 GMT Sender: news@media-lab.MEDIA.MIT.EDU Lines: 78 I didn't attempt to setup my internal drive as 'swapdrive' because someone told me that I can no longer boot from the internal drive and if I do the symlinks in the internal drive would be messed up. Does anyone know how to use the internal drive as swapdrive and still be able to boot from it (in case the external crash)? Thanks! Simon Tung --- The interal 105Mbyte drive is a reasonably fast drive, if your external drive is slower, then you should definitely consider using the internal disk to swap. The choice you have to make is whether use the internal or external drive your root disk. If you make the internal the booted disk and the root disk then you will need to make symlinks all over the place. This is possible if you are confident where things are. If you are going to use the external drive to boot and use as the root partition, then follow the instructions in NeXTanswers QA355 below (minus formatting info) pasc swapdisk other than on 40 Q: Does anyone have any experience setting up an alternative swap device? I'm booting off the Ethernet and want to swap to a 330. Do I just label my 330 as swapdisk? A: Following is the answer, and lots of background. The quick answer, though: yes, call it swapdisk and things (mostly) work, with only a little more to do, like modifying swaptab(5) and fstab(5). When the system boots up, it runs /etc/rc, a shell script. The rc script (rc stands for *Run Control:) is what does *multi-user start-up.: One thing to recognize is that in single-user land, the virtual memory system is turned off: no paging is done. The paging system is fired up during multi-user start-up. (Now, one might think this is a big limitation on single-user mode's usefulness. Not really: we have a minimum 8MB of core, so without the Window Server and the Workspace Manager, there's lots of r oom in which to play.) In the *Goode Olde Dayes,: the system would (typically) page to the file /private/vm/swapfile Typically, because it's actually configurable, in /etc/swaptab (yes, there's a man page: section 5). The mach_swapon(8) command, invoked in rc, reads swaptab and enables paging on the specified files. And that was that, mostly. Now we have the possibility of the swapdisk, which we want to use automatically. So, another rc script was written: rc.swap handles the determination of whether there's a swapdisk present, and, if so, turning on paging to it. To do this, rc.swap looks in /etc/fstab, trying to find a file system called /private/swapdisk which should be mounted. (NOTE: this information is NOT obtained from NetInfo!) If it finds one, it looks at the device's label, to see if the device is called swapdisk. If not, it igno res the disk; if so, it continues on to enable paging on that disk. (See the checkswap(8) command for yet more details.) Specifically, to enable paging, rc.swap first mounts the file system. Then, it ensures that the file /private/swapdisk/vm/swapfile exists, and invokes mach_swapon to turn on paging P turning it on explicitly to this file, and not consulting swaptab. In addition, rc.swap ensure that /tmp references a directory on the swapdisk. None of this changes what rc itself does, though. It still invokes mach_swapon, just like in the Goode Olde Dayes. This will enable paging to two files (based on the standard configuration of swaptab): /private/swapdisk/vm/swapfile /private/vm/swapfile This might seem like A Good Thing, but it isn't. Last we knew, there was a (minor?) bug which prevented using multiple swapfiles successfully. (The bug is that if a mapped file spans swapfile boundaries, not-completely-predictable things can happen. To tickle the bug, though, the primary swapfile must fill up first.) Should be benign, really. So, back to the original question! Here it is again: Q: Does anyone have any experience setting up an alternative swap device? I'm booting of the Ethernet and want to swap to a 330. Do I just label my 330 as swapdisk? Yes, label the 330 as swapdisk, and all should be fine. Note that everything after the first eight characters in the disk name is ignored, so swapdisk1 or swapdiskFuBar is supposed to work, too. But, please please please don't then boot off the 330 after having used it for a swapdisk: /tmp will be screwed up. Remember that rc.swap puts points /tmp to the swapdisk? Well, you end up with /tmp referencing (eventually) /private/swapdisk/tmp (We say *eventually: because there are multiple levels of symbolic links). So at best, a bit of mucking around, perhaps in rc, will be needed to set things back to rights. If you're always going to boot off the network, then 7 rename your disk to be swapdisk; 7 be sure that /private/swapdisk is referenced in the client partition's fstab; 7 to be safe, be sure that /private/vm/swapfile is not referenced in the client partition's swaptab. A reasonable fstab entry for this would be /dev/sd0a /private/swapdisk 4.3 rw,noquota,noauto 0 1 And, if booting off both the network and the 330 is desired, add stuff to ensure that /tmp is always a valid reference (perhaps adding this to rc.swap would be reasonable: if no swapdisk is present, ensure that /tmp references /private/tmp, and that /private/tmp is a real directory, not a link to, for example, /private/swapdisk/tmp). Incidentally, one CAN use a swapdisk in conjunction with booting off a SCSI. Just connect up an outboard disk, name it swapdisk, ensure there's a file system on it, and put the device in fstab, using a line like that above but specifying /dev/sd1a instead of /dev/sd0a, for example. QA355