Finally adding that swap file

Jeff Vian jvian10 at charter.net
Sat Oct 29 13:32:00 UTC 2005


On Sat, 2005-10-29 at 08:05 -0500, akonstam at trinity.edu wrote:
> On Fri, Oct 28, 2005 at 11:03:42PM -0500, Bruno Wolff III wrote:
> > On Sat, Oct 29, 2005 at 03:03:35 +0200,
> >   Dotan Cohen <dotancohen at gmail.com> wrote:
> > > I have one hard disk with three partions: /, /boot, and /home. I want
> > > to add a swap file on the /home partion, because it has the most
> > > available space. I found lots of pages where it gives instructions on
> > > how to add the file, but they all seem to want to put the file on /.
> > 
> > There does seem to be some sort of problem with it not being on /. The
> > swapon -a during boot doesn't seem to turn on swapfiles on other partitions
> > even though as far as I can tell they should be mounted by that point.
> > swapon -a after boot does pick them up.
> > I didn't pursue this too far, so I might have missed something. For the
> > time being I put a swap file on both / and another file system (on a second
> > disk). The one on / gives me enough swap space for normal use and I can
> > turn on the other one manually after reboots.
> > 
> 
> swapon should work on swap files no matter what partition they are in.
> At it least it used to work for me on earlier Fedora versions.- 
> 
Swap partitions are not dependent upon mounted filesystems, but a swap
file is.  The one critical thing is the partition where the swap file is
located MUST be mounted before swap is activated.  That is why it is
recommended that the swap file be in /, since / is mounted before any
others and swap is enabled very early in the boot process.

If you want to place it elsewhere that is not mounted and thus not able
to activate at the normal swapon point, an easy workaround may to put a
line in /etc/rc.local and run swapon for that file from there.





More information about the fedora-list mailing list