In article <JAFFER.93Jul4233647@camelot.ai.mit.edu> jaffer@zurich.ai.mit.edu (Aubrey Jaffer) writes:OK, here we go again: 'windows-linux swap in common?'. Perhaps time for moving this into the FAQ (I assume it's not there already, havn't checked...)? A swap *file* cannot be shared between, as dos can't access the linux file system and linux can't swap on the dos file system. However a linux swap partion can be made into a swap file for windows at the cost of a few seconds longer time to reboot. If you want to do things the same way as I have done then follow these steps: (remember to subtitute the sizes and partions to match your computer, else.... bad luck!) 1) Make sure you don't use swap at the moment, i.e. remove all swapon commands from your /etc/rc and do a swapoff. 2) Decide how much swap space you need and create a partion to swap on with fdisk (or any other disk partioning program). I chose to make it about 6M or to be exact 5967 blocks large and on /dev/hda4. Make the partion a DOS partion. Mine is a primary 12-bit-fat (id 1) partion. 3) Erase the partion completely so that it will compress to the smallest possible size. This can be done with : dd if=/dev/zero of=/dev/hda4 while running linux. If you want to you can use norton's wipeinfo instead to 'Wipe the entire drive' but this must be done after step 3). Neither 'format e:' or 'del e:*.*' will erase the data on the disk, they just delete the information in the directory block(s) and wont work. 4) (Re)Boot dos. The swap partion will show up as a new 'disk letter' in dos, which dos wont be able to read (dos says something like 'Invalid media error on drive E'). My swap partion shows up as E:. Format the new drive: c:\>format e: 5) Start windows (if you are running windows 3.0 you must start it in real mode: c:\>win /r) and create a permanent swap file as large as the new partion. Ignore the warning that windows wont use more than the recommended size, it will. In windows 3.0 this is done by closing ALL active applications excluding the program manager, selecting File/Run and run 'system/swapfile'. In windows 3.1 it's in the control panel under '386 Enh' and 'virtual memory'. 6) Reboot your into linux. DO NOT start windows. 7) Save and compress the swap partion to a file: dd if=/dev/hda4 | gzip -9 > /.winswap Since you erased the whole partion the compressed file will become very small; from my computer: 23:27-oden:/>ls -l .winswap -r-------- 1 root root 9431 Apr 10 20:23 .winswap 8) Place the following commands in your /etc/rc: /bin/mkswap /dev/hda4 5967 /bin/swapon -a and a line in /etc/fstab describing your swap partion: /dev/hda4 none swap defaults 9) These commands will destroy the dos partion and the windows swap file and must be restored before windows can be used. I do this when I reboot linux automatically with this script which I have named /etc/reboot and with a link to it from /etc/halt: ----/etc/reboot-----snip-----8<-------- #!/bin/sh - if [ "root" != "`whoami`" ] then echo "Sorry "`whoami`. You must be root to "`basename $0`"!. Exiting." exit 1 fi echo `basename $0` in progress. Please standby swapoff /dev/hda4 /usr/local/bin/gunzip < /.winswap > /dev/hda4 exec /etc/.hidden/`basename $0` $* ----end /etc/reboot-----snip-----8<---- and I have moved the original /etc/reboot and /etc/halt to /etc/.hidden/reboot and /etc/.hidden/halt 10) Enjoy. 11) Realize that 6M of swap isn't enough even with 8M of ram and feel sad ;-) I have seen some peolpe suggesting that it is possible to just save the beginning of the partion (just enough to hold the boot blocks, the fat and the root directory), and others saying that you must save the whole partion but I havn't bothered to investigate this matter, the solution above works just perfect. /Kristian p.s. I hope I havn't mistyped anything but anyway: Be careful when dealing with the disk partions as you will blame yourself to death when you have erased your whole dos partion with your five years worth of work on just because you typed /dev/hda4 instead of /dev/hda3 ;-) -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Kristian Ejvind - krej@it.kth.se I The best way of accelerating The Royal Institute of Technology, KTH I a macintosh is by 9.82 m/(s*s) Stockholm, Sweden I -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Eric Hopper | Question about Reiser4 |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| Nigel Kukard | SATA problems |
git: | |
| Junichi Uekawa | Re: [ANNOUNCE] GIT 1.5.4 |
| Miles Bader | way to automatically add untracked files? |
| Michael Hendricks | removing content from git history |
| Thomas Glanzmann | SLES 10 git packages |
| Adrian Bunk | Re: [BUG] New Kernel Bugs |
| Auke Kok | [PATCH] e1000e: test MSI interrupts |
| Felix Radensky | RE: e1000e "Detected Tx Unit Hang" |
| Jesper Dangaard Brouer | [PATCH 0/2] HTB scheduler HTB_HYSTERESIS modifications |
| Daniel Ouellet | Re: Could Hiawatha replace Apache as in base HTTP server if it's license changed? |
| Jonathan Steel | Performance Issues of Intel Quad Port NIC |
| James Hartley | scp batch mode? |
| Stuart Henderson | Re: Using trunk(4) to put a router in a switch ring |
| VPN's on NetBSD | 6 hours ago | NetBSD |
| Why does uClinux 2.6.18 bootup block SuperIO UART IRQs that BIOS configured | 7 hours ago | Linux kernel |
| USB statistics | 8 hours ago | Linux kernel |
| Block Sub System query | 13 hours ago | Linux kernel |
| kernel module to intercept socket creation | 14 hours ago | Linux kernel |
| Image size changing during each build | 14 hours ago | Linux kernel |
| Soft lock bug | 19 hours ago | Linux kernel |
| sysctl - dynamic registration problem | 1 day ago | Linux kernel |
| Question on swap as ramdisk partition | 1 day ago | Linux kernel |
| serial driver xmit problem | 1 day ago | Linux kernel |
