I haven't used a swap partition on any of my systems (intel celeron, p3, amd64, intel xeon) for over... what... 10 years? Swapfiles only, and sometimes I don't even mount the swap. Although I have never removed support for any kind of swap from my kernel.
dd if=/dev/zero of=/path/to/swapfile bs=1M count=1024 mkswap /path/to/swapfile swapon /path/to/swapfile (btw, I like to put the swap file in /root or /boot, but that's my pref, on space constrained PC, i would put a swapfile on every drive to distribute it). I don't have access to my box to confirm but I think /etc/fstab would be setup the same as normal swap except with the file path instead of the device partition. Except for issue pointed out by Paul about hibernation, dd line above takes care of non-sparsity. As for security, having a swap is less secure than having none: a malicious persion could extract information from programs memory which was swapped (ie, like the decripted information "for your eyes only"). Having no swap at all was a problem on small systems with little RAM when emerging big stuff (boost failed all the time on a pc with 256mb). Resizing swap "on-the-fly" with swapfiles: And on HDD-space constrained system, i used to have several swapfiles that I created and deleted in the manner above, that I named swapfile-256, swapfile-512, etc... A smooth "upgrade of swap on-the-fly" was done this way: say I had 256 swapped on, I could swap on a new 512 (768 total at moment, all data still on 256mb file), then swapoff the 256 (takes a bit of time for swap data to move over), delete the 256. Downgrade can be done in the same manner. "swapon -s" (status) will be a good friend of yours now. Good luck! Simon On Wed, May 2, 2012 at 2:53 PM, walt <w41...@gmail.com> wrote: > I have two machines with 4GB of ram and I've never seen either one use > swapspace (yet) so I'm thinking I could delete my swap partitions and > substitute a much smaller swapfile -- if it's safe. > > Any downside to using a swap file instead of a swap partition, maybe > depending on which filesystem you use, or something? Security holes? > Any horror stories out there? > >