LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 06-26-2013, 11:18 PM   #1
Froggy192
LQ Newbie
 
Registered: Jun 2013
Distribution: Windows 8, Mint 15
Posts: 12

Rep: Reputation: 0
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?
 
Old 06-26-2013, 11:34 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Sharing swap space between Linux and FreeBSD
 
Old 06-28-2013, 11:34 AM   #3
Froggy192
LQ Newbie
 
Registered: Jun 2013
Distribution: Windows 8, Mint 15
Posts: 12

Original Poster
Rep: Reputation: 0
I read through it, and I can't seem to...

Quote:
...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:

awk -- '/swap/ && ($1 !~ /#/) { system("mkswap "$1"") }' /etc/fstab
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?
 
Old 06-28-2013, 01:50 PM   #4
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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.
 
Old 06-28-2013, 04:03 PM   #5
Froggy192
LQ Newbie
 
Registered: Jun 2013
Distribution: Windows 8, Mint 15
Posts: 12

Original Poster
Rep: Reputation: 0
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.
 
Old 06-28-2013, 06:21 PM   #6
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
This is the command I used to search through /etc for any file with the word "swapon" in the file.

Code:
find /etc -type f | xargs grep -A 5 -B 5 -i swapon
I hope this produced useful results for you.

Last edited by bigrigdriver; 06-28-2013 at 06:22 PM.
 
Old 06-28-2013, 07:47 PM   #7
Froggy192
LQ Newbie
 
Registered: Jun 2013
Distribution: Windows 8, Mint 15
Posts: 12

Original Poster
Rep: Reputation: 0
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'm not quite sure what happened here.
 
Old 06-28-2013, 08:07 PM   #8
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Maybe it is just me, but I don't like sharing swap

Not that I do it very often,
but I like the option of hibernating and starting where I left once done with what I dual booted.
 
Old 06-28-2013, 08:15 PM   #9
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by Froggy192 View Post
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 {} ';'
Edit: added -H to the grep to print filename

Last edited by Firerat; 06-28-2013 at 08:18 PM.
 
Old 06-28-2013, 09:16 PM   #10
Froggy192
LQ Newbie
 
Registered: Jun 2013
Distribution: Windows 8, Mint 15
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Firerat View Post
You have spaces in the Dir names

try
Code:
find /etc -type f -exec grep -H -A 5 -B 5 -i swapon {} ';'
Edit: added -H to the grep to print filename
This works, but it doesn't find anything either.

Strange... do I not have anything that causes 'swapon'?
 
Old 06-28-2013, 10:29 PM   #11
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by Froggy192 View Post
This works, but it doesn't find anything either.

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
 
Old 07-27-2013, 02:06 PM   #12
vorbote
Member
 
Registered: Aug 2009
Location: 2,625 m of paranoia above sea level
Distribution: Arch Linux, Debian GNU/Linux, Fedora, Void Linux, FreeBSD, OpenBSD and Win10
Posts: 77

Rep: Reputation: Disabled
All those hacks are not needed.

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.

Last edited by vorbote; 07-27-2013 at 02:07 PM.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 02:16 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
swap partition unable to work baosheng Linux - Software 3 10-11-2006 10:03 PM
swap partition wont work sancho1980 Linux - Newbie 1 09-29-2006 03:57 PM
Does freebsd need swap partition? babyboss *BSD 1 08-17-2005 03:32 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration