Bug 204485 - swapfile not mounted on boot
Summary: swapfile not mounted on boot
Status: Closed DUPLICATE of bug 181565
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 10.2-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-12 00:31 UTC by zsolt.ero
Modified: 2018-05-28 12:32 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zsolt.ero 2015-11-12 00:31:26 UTC
By following the relevant section of the handbook (https://www.freebsd.org/doc/handbook/adding-swap-space.html) I created a swap file and set up fstab:

dd if=/dev/zero of=/usr/swap0 bs=1m count=2048
chmod 0600 /usr/swap0
echo "md99 none swap sw,file=/usr/swap0 0 0" >> /etc/fstab

Now, running "swapon -aL" does indeed mount the swap file.

The problem is that after reboot, the swap file is not mounted, and running "swapon -aL" returns the following error: "md99 on /usr/swap0: Device already in use"

I found a thread in the forum, which confirms that this is present in 10.0 and 10.1:
https://forums.freebsd.org/threads/freebsd-10-wont-add-swap-file.47167/

Upon asking on IRC, it was confirmed that it is a bug and it's recommended that a bug ticket should be created for this.
Comment 1 zsolt.ero 2015-11-12 00:49:50 UTC
A temporary workaround while this gets fixed is to put the swap line in a separate fstab file and mount it manually in rc.local:

echo "md99 none swap sw,file=/usr/swap0 0 0" >> /etc/fstab_fix
echo "swapon -F /etc/fstab_fix -aL" > /etc/rc.local
Comment 2 Robert Schulze 2016-01-22 15:45:41 UTC
Just add "late" to the mount options. This is not properly documented.
Comment 3 Robert Schulze 2016-01-22 15:47:50 UTC
Duplicate of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=181565
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 12:32:36 UTC

*** This bug has been marked as a duplicate of bug 181565 ***