Would a Linux swap partition work as a FreeBSD swap partition?
*BSDThis forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Would a Linux swap partition work as a FreeBSD swap partition?
I understand that a single linux swap partition could work as a swap partition for multiple distros, but could I use the same partition as a FreeBSD swap partition?
...find the script that runs swapon at boot time. In Red Hat Linux it is /etc/rc.d/rc.sysinit. Put the following line into that file just before swapon -a:
Well, I actually did find /etc/init/rc-sysinit.conf, but there's no indication of anything swap-related in it. Would I need to add everything in there myself, or is the swapon in another file?
Since Debian (my OS) and Mint are closely related, the file I find in Debian which seems to have the code to turn swap on is /etc/init.d/checkroot.sh. Look for this block of code:
Code:
/etc/init.d/checkroot.sh- if [ "$ENABLE_SWAP" = yes ]
/etc/init.d/checkroot.sh- then
/etc/init.d/checkroot.sh- if [ "$VERBOSE" = no ]
/etc/init.d/checkroot.sh- then
/etc/init.d/checkroot.sh- log_action_begin_msg "Activating swap"
/etc/init.d/checkroot.sh: swapon -a -e >/dev/null 2>&1
/etc/init.d/checkroot.sh- log_action_end_msg $?
/etc/init.d/checkroot.sh- else
/etc/init.d/checkroot.sh- log_daemon_msg "Activating swap"
/etc/init.d/checkroot.sh: swapon -a -v
/etc/init.d/checkroot.sh- log_end_msg $?
/etc/init.d/checkroot.sh- fi
/etc/init.d/checkroot.sh- fi
In that block you wil find the swapon -a command (swapon -a -e >/dev/null 2>&1) referred to in the instructions.
I have found other references to swap in /etc, but they refer to running swapon again (note that "again" implies swap should be running, but we run swapon again "just in case" it isn't).
Last edited by bigrigdriver; 06-28-2013 at 01:52 PM.
I've looked for that file, and it doesn't exist in my system and I haven't modified it in any way related to this. I do have two other files titled "checkroot.sh.conf" and "checkroot-bootclean.sh.conf" that reside in /etc/init, but they have nothing close to what you've got - they're almost empty.
Also, I've tried to find any file with "swapon" in it without any success, although my swap works perfectly fine.
I used this to try to do the same thing, although nothing showed up at all:
Code:
rgrep -i swapon /etc
And this is the output of what you used:
Code:
neutrino ~ # find /etc -type f | xargs grep -A 5 -B 5 -i swapon
grep: /etc/NetworkManager/system-connections/Auto: No such file or directory
grep: W782k4p: No such file or directory
grep: /etc/skel/.config/chromium/Local: No such file or directory
grep: State: No such file or directory
grep: /etc/skel/.config/chromium/Safe: No such file or directory
grep: Browsing: No such file or directory
grep: Cookies-journal: No such file or directory
grep: /etc/skel/.config/chromium/Safe: No such file or directory
grep: Browsing: No such file or directory
grep: Bloom: No such file or directory
grep: /etc/skel/.config/chromium/Safe: No such file or directory
grep: Browsing: No such file or directory
grep: Cookies: No such file or directory
grep: Provider: No such file or directory
grep: Cache: No such file or directory
grep: /etc/skel/.config/chromium/Default/Current: No such file or directory
grep: Session: No such file or directory
grep: /etc/skel/.config/chromium/Default/Network: No such file or directory
grep: Action: No such file or directory
grep: Predictor-journal: No such file or directory
grep: /etc/skel/.config/chromium/Default/Current: No such file or directory
grep: Tabs: No such file or directory
grep: /etc/skel/.config/chromium/Default/Session: No such file or directory
grep: Storage/LOCK: No such file or directory
grep: /etc/skel/.config/chromium/Default/Session: No such file or directory
grep: Storage/CURRENT: No such file or directory
grep: /etc/skel/.config/chromium/Default/Session: No such file or directory
grep: Storage/000003.log: No such file or directory
grep: /etc/skel/.config/chromium/Default/Session: No such file or directory
grep: Storage/MANIFEST-000002: No such file or directory
grep: /etc/skel/.config/chromium/Default/Session: No such file or directory
grep: Storage/LOG: No such file or directory
grep: /etc/skel/.config/chromium/Default/Archived: No such file or directory
grep: History-journal: No such file or directory
grep: /etc/skel/.config/chromium/Default/Visited: No such file or directory
grep: Links: No such file or directory
grep: /etc/skel/.config/chromium/Default/Web: No such file or directory
grep: Data: No such file or directory
grep: /etc/skel/.config/chromium/Default/Origin: No such file or directory
grep: Bound: No such file or directory
grep: Certs: No such file or directory
grep: /etc/skel/.config/chromium/Default/Managed: No such file or directory
grep: Mode: No such file or directory
grep: Settings: No such file or directory
grep: /etc/skel/.config/chromium/Default/Login: No such file or directory
grep: Data-journal: No such file or directory
grep: /etc/skel/.config/chromium/Default/Top: No such file or directory
grep: Sites: No such file or directory
grep: /etc/skel/.config/chromium/Default/Network: No such file or directory
grep: Action: No such file or directory
grep: Predictor: No such file or directory
grep: /etc/skel/.config/chromium/Default/Archived: No such file or directory
grep: History: No such file or directory
grep: /etc/skel/.config/chromium/Default/Login: No such file or directory
grep: Data: No such file or directory
grep: /etc/skel/.config/chromium/Default/User: No such file or directory
grep: StyleSheets/Custom.css: No such file or directory
grep: Index: No such file or directory
grep: 2013-05: No such file or directory
grep: /etc/skel/.config/chromium/Default/Web: No such file or directory
grep: Data-journal: No such file or directory
grep: /etc/skel/.config/chromium/Default/Top: No such file or directory
grep: Sites-journal: No such file or directory
grep: /etc/skel/.config/chromium/Default/Origin: No such file or directory
grep: Bound: No such file or directory
grep: Certs-journal: No such file or directory
grep: /etc/skel/.config/chromium/First: No such file or directory
grep: Run: No such file or directory
grep: /etc/skel/.config/chromium/Safe: No such file or directory
grep: Browsing: No such file or directory
grep: Bloom: No such file or directory
grep: Filter: No such file or directory
grep: 2: No such file or directory
grep: /etc/skel/.config/chromium/Service: No such file or directory
grep: State: No such file or directory
grep: /etc/skel/.mozilla/firefox/Crash: No such file or directory
grep: Reports/InstallTime20110422203143: No such file or directory
I used this to try to do the same thing, although nothing showed up at all:
Code:
rgrep -i swapon /etc
And this is the output of what you used:
Code:
neutrino ~ # find /etc -type f | xargs grep -A 5 -B 5 -i swapon
grep: /etc/NetworkManager/system-connections/Auto: No such file or directory
grep: W782k4p: No such file or directory
grep: /etc/skel/.config/chromium/Local: No such file or directory
grep: State: No such file or directory
I'm not quite sure what happened here.
You have spaces in the Dir names
try
Code:
find /etc -type f -exec grep -H -A 5 -B 5 -i swapon {} ';'
Strange... do I not have anything that causes 'swapon'?
try to work out what is happening
i.e. follow the boot process
/etc/rc.*.d
are your different runlevels,
the files in there are just sysmlinks to /etc/init.d/
have a read of those scripts
You can ignore things like network, you are interested in mounting things
I'll necrobump this thread a bit to make an observation: The hack described in comment 2 is old, very old. As in completely useless advice from last century.
The fact is that since version 8, FreeBSD can mount and use a GNU/Linux formatted swap partition by simply adding the partition to the fstab file. This from personal experience. The only thing you must be careful about is to not boot FreeBSD if you have hibernated Linux previously as this will erase the hibernate file written to the swap partition, but that applies to any other Linux distro that may be installed in the same system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.