Share the same SWAP partition in Linux and Windows
If you’re short on hard disk space and would like to share the same SWAP partition in Linux and Windows, you can try the following trick:
1. Format the partition as a DOS partition and create the Windows SWAP file on it, but do not boot Windows yet.
2. Boot in Linux and save the partition to a file. Assuming the partition is on /dev/hda5 we’ll do a
dd if=/dev/hda5 of=/etc/dosswap
3. Compress the dosswap file with
gzip -9 /etc/dosswap
4. Add the following in your /etc/rc file to prepare and install the Linux SWAP. XXXX represents the number of blocks of the SWAP partition:
mkswap /dev/hda5 XXXXX
swapon -av
5. Add the newly-created partition to /etc/fstab .


