LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Swap in a read-only linux system (https://www.linuxquestions.org/questions/linux-newbie-8/swap-in-a-read-only-linux-system-758376/)

coffeecoffee 09-29-2009 12:48 AM

Swap in a read-only linux system
 
Hi I have managed to modify my /etc/fstab and various files to allow my root directory (/) to be read-only. I've also used tmpfs in a few special directories like /var/log.

However, I am concerned that there is swap space on my system being written to. This is a problem because the disk is a Compact Flash which cannot take too many write cycles before dieing (it's for a specialised embedded system). I would like to disable any swap space. How can I do this?

Any help appreciated. Thanks.

~sHyLoCk~ 09-29-2009 12:53 AM

Remove the swap entry from /etc/fstab

coffeecoffee 09-29-2009 12:55 AM

Quote:

Originally Posted by ~sHyLoCk~ (Post 3700178)
Remove the swap entry from /etc/fstab

I can't really see any swap references in the fstab, would one of these be it?:

Code:

rootfs on / type rootfs (rw)
none on /sys type sysfs (rw,nosuid,nodev,noexec)
none on /proc type proc (rw,nosuid,nodev,noexec)


~sHyLoCk~ 09-29-2009 01:01 AM

What is the o/p of;
Code:

swapon -s

coffeecoffee 09-29-2009 01:21 AM

Quote:

Originally Posted by ~sHyLoCk~ (Post 3700183)
What is the o/p of;
Code:

swapon -s

o/p?
swapoff only works once i have booted in to the system.. i need permanent disabling. i will delete the swap partition and see what happens

Diomedes 09-29-2009 02:09 AM

I believe shylock means "output". I'm interested, too.

~sHyLoCk~ 09-29-2009 02:16 AM

Quote:

Originally Posted by Diomedes (Post 3700243)
I believe shylock means "output". I'm interested, too.

Yup.
Btw are you using a swap file or swap partition? Since the swap partition should be in fstab :scratch:

coffeecoffee 09-29-2009 05:30 AM

Quote:

Originally Posted by ~sHyLoCk~ (Post 3700249)
Yup.
Btw are you using a swap file or swap partition? Since the swap partition should be in fstab :scratch:

Oh sorry, I misunderstood. There was a line in the /etc/fstab file for swap, so I commented it out and when I run the swapon -s command I get nothing, just the table 'headers':

Code:

Filename                                Type            Size    Used    Priority
The weird thing is when I boot, my compact flash still appears to be written to because the CF write LED is flashing... any ideas?

~sHyLoCk~ 09-29-2009 05:44 AM

Your swap is definitely off. I don' know why the Write LED is flashing at boot time. It maybe due to logging or something else.

linuxlover.chaitanya 09-29-2009 05:47 AM

If the swap has been disabled and you do not need it, then why not just remove CF ?

coffeecoffee 09-29-2009 06:21 PM

Quote:

Originally Posted by linuxlover.chaitanya (Post 3700414)
If the swap has been disabled and you do not need it, then why not just remove CF ?

Well, even though I won't be writing to it, I need the CF to read from.


All times are GMT -5. The time now is 11:59 PM.