Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#298390 - 13/05/2007 15:31 Running linux off a CF card
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3996
Loc: Manchester UK
I'm currently preparing a machine that will be running in a harsh environment (transmitter shed with no decent air con).

I'd like this machine to boot off flash so the only moving things are the fans in the case. I've pretty much settled on Xubuntu which uses xfce as its window manager and sits happily on a 2GB Parallels drive on my test machine. I've got it set up just as I want and I'll be trying an actual install tomorrow.

My question is, given the reluctance to continually write to any type of flash device. Is there anything I should be trying to put in a ramdisk to avoid hitting the flash too often.

This is what's currently mounted on the test system:

Code:

/dev/sda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.20-15-generic/volatile type tmpfs (rw)



It appears to me the two most likely candidates (/var/run and /var/lock) appear to mounted from something already. Any recommendations?

The computer itself is one of these, I have a bunch of them because they're really useful (on board CF and 3 NIC's).
_________________________
Cheers,

Andy M

Top
#298391 - 13/05/2007 16:46 Re: Running linux off a CF card [Re: andym]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
Have a look at this article for laptop mode. Some of the suggestions like setting noatime you'll want to do.

Top
#298392 - 14/05/2007 20:18 Re: Running linux off a CF card [Re: tman]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3996
Loc: Manchester UK
Some good points there, will give them a try.

I'd still like to put some things in a ramdisk, suggestions anyone? Was hoping Mark might have some ideas.
_________________________
Cheers,

Andy M

Top
#298393 - 14/05/2007 21:40 Re: Running linux off a CF card [Re: andym]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Quote:
Some good points there, will give them a try.

I'd still like to put some things in a ramdisk, suggestions anyone? Was hoping Mark might have some ideas.


Sure. Remount the root filesystem as read-only, and then wait for programs to complain. Whatever they're writing belongs on a tmpfs (or f/s on top of a ramdisk, for the old-fashioned).

That's my two cents.

Top
#298394 - 14/05/2007 21:43 Re: Running linux off a CF card [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Quote:
Quote:
Some good points there, will give them a try.

I'd still like to put some things in a ramdisk, suggestions anyone? Was hoping Mark might have some ideas.


Sure. Remount the root filesystem as read-only, and then wait for programs to complain. Whatever they're writing belongs on a tmpfs (or f/s on top of a ramdisk, for the old-fashioned).



Actually, what I would really do is just add a little bit of code in the kernel to the sys_open() handler, and have it log the process id/name each time that a program opens a file for RDWR/WRONLY access. Then go after the offenders it identifies and ensure those files end up in RAM.

Once all of that is working, just have the root filesystem always mounted R/O by default.

Cheers

Top
#298395 - 14/05/2007 22:11 Re: Running linux off a CF card [Re: mlord]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3996
Loc: Manchester UK
That sounds so ingenious i'm kicking myself for not thinking of it already!

While idea 2 sounds the best, i've never had much luck with compiling kernels under any of the 'buntu's. So will probably try the r/o idea first.

Do you know anything about how/why the run and lock directories are mounted as they are in ubuntu? My gentoo machines don't use this and a quick google didn't turn anything up.
_________________________
Cheers,

Andy M

Top
#298396 - 15/05/2007 10:12 Re: Running linux off a CF card [Re: andym]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Quote:

Do you know anything about how/why the run and lock directories are mounted as they are in ubuntu? My gentoo machines don't use this and a quick google didn't turn anything up.

Those are on tmpfs, which is a 100% in-RAM filesystem emulator, exactly what you want for them. They get used for temporary lock files and "PID" files for daemons, stuff that is *never* wanted to survive over a reboot.

EDIT: to roll your own tmpfs, do something like this:

mkdir /junk
mount tmpfs /junk -t tmpfs

Now you have /junk/ as an in-RAM filesystem.

EDIT AGAIN:
Note that Ubuntu also places the udev-generated /dev/ on tmpfs, and hides the real (static) /dev/ underneath it at /dev/.static/dev/

Cheers


Edited by mlord (15/05/2007 10:16)

Top
#298397 - 15/05/2007 14:13 Re: Running linux off a CF card [Re: andym]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
There is also a command-line utility to find file-writers etc.. which might be useful to you. The command is fuser and it has a reasonably okay man page.

-ml

Top
#298398 - 15/05/2007 14:23 Re: Running linux off a CF card [Re: mlord]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4180
Loc: Cambridge, England
Quote:
There is also a command-line utility to find file-writers etc.. which might be useful to you. The command is fuser and it has a reasonably okay man page.

Ooo, now that's handy. I hadn't come across that!

Peter

Top
#298399 - 15/05/2007 14:29 Re: Running linux off a CF card [Re: peter]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Quote:
Quote:
There is also a command-line utility to find file-writers etc.. which might be useful to you. The command is fuser and it has a reasonably okay man page.

Ooo, now that's handy. I hadn't come across that!

Peter


It's really quite simple -- it just scans all of the /proc/*/fd/* entries matching against whatever one asks for.

But potentially quite handy.

Cheers

Top
#298400 - 15/05/2007 15:18 Re: Running linux off a CF card [Re: peter]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
That's a fairly common Unix command. You'll find it on many OSes. The BSDs have fstat. I find lsof to be a more useful alternative.
_________________________
Bitt Faulk

Top
#298401 - 15/05/2007 15:50 Re: Running linux off a CF card [Re: wfaulk]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
Quote:
That's a fairly common Unix command. You'll find it on many OSes. The BSDs have fstat. I find lsof to be a more useful alternative.


Hmm. Useful. I normally just ls -l /proc/*/fd | grep
_________________________
-- roger

Top
#298402 - 15/05/2007 16:59 Re: Running linux off a CF card [Re: mlord]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3996
Loc: Manchester UK
Thanks Mark, you are the fscking man when it comes to all things Linux!
_________________________
Cheers,

Andy M

Top