LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Thread Tools
Old 11-08-2009, 07:15 PM   #1
Bviper
LQ Newbie
 
Registered: Dec 2006
Distribution: Debian 5.0
Posts: 9
Thanked: 0
Installing Debian to a compact flash card


[Log in to get rid of this advertisement]
I realize this question comes up every now and then, and have found quite a bit of information regarding the subject. I just want to make sure I'm not missing anything. A few configuration tweaks I've found:

1. Do not format a swap partition (not a problem, have 4GB of memory for a system that will probably use <256MB.

2. Don't use ext3 as its journaled (so what file system should I use? ext2?)

3. Disable logs (not sure how to do this)

4. I also found this post http://www.linuxquestions.org/questi...66#post2768166 (I get the gist of it, but it's 2 years old does it still apply?)

5. Mount filesystem as read only (is this really necessary, and if so how is it done)


In case anyone is wondering, the system is basically going to be a NAS. It will run OpenSSH, ifenslave-2.6, and iscsitarget ONLY (besides a standard system install). I got tired of dealing with FreeNAS and Openfiler, so I played around with creating RAID arrays and ethernet bonding and feel I can do it better myself.

If anyone could answer some of the questions, or provide any more tips for reducing writes to a CF card I'd be much appreciative.

Last edited by Bviper; 11-08-2009 at 08:00 PM..
windows_vista Bviper is offline     Reply With Quote
Old 11-08-2009, 07:33 PM   #2
linus72
Senior Member
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Ultimate-Edition-2.3/ 503box-Live/SalixOS/Phalanx-9.04/Absolute/Fed 11/Paldo
Posts: 2,861
Thanked: 227
Yep, never make a swap partition on usb thumbdrives/cf cards,etc

ext2 vs ext3
which is more important to you?
more writes to usb but better data integrity with ext3
vs
less space used & slightly less writes with less data integrity with ext2

I personally use ext2 on persistent usb installs
as it "seems" to be healthier for life of USB

Not sure about logs?

I always usually have my /etc/fstab
setup so usb is mounted rw
though some distro's
when running in non-persistent mode
will run from usb and will have usb mounted as read-only

here's my lenny hd install /etc/fstab
it sees usb as sda1

Code:
/dev/sda1 /media/usb0 auto   user,norelatime,noauto,rw   0   0
other members here more experienced will help too
linuxdebian linus72 is online now     Reply With Quote
Thanked by:
Old 11-11-2009, 04:07 PM   #3
dchost
LQ Newbie
 
Registered: Oct 2009
Posts: 10
Thanked: 2
/etc/defaults/rcS

RAMRUN=yes
RUNOCK=yes
that changes /var/lock and /var/run to tmpfs

-for the network you must change directory /etc/networking to /var/ (each boot, ifstate file)

-ext2 (faster) with noatime

-boot option kernel ro

-fstab
/dev/"cf_card" / defaults,noatime,ro 0 0

Last edited by dchost; 11-13-2009 at 11:17 AM..
macos dchost is offline     Reply With Quote
Thanked by:
Old 11-12-2009, 05:59 AM   #4
coffeecoffee
Member
 
Registered: Feb 2009
Posts: 45
Thanked: 1
Quote:
Originally Posted by Bviper View Post
3. Disable logs (not sure how to do this)
I would just do as everyone else is saying and mount /var/log as tmpfs in /etc/fstab

Quote:
4. I also found this post http://www.linuxquestions.org/questi...66#post2768166 (I get the gist of it, but it's 2 years old does it still apply?)

5. Mount filesystem as read only (is this really necessary, and if so how is it done)
Yes due to the limited number of write cycles CF cards have, this is required. I had to do a similar thing. As well as the things mentioned above, run "tune2fs -c 0 /dev/hdaxx" "and tune2fs -i 0 /dev/hdaxx" to stop mount counts, which are also writes to the CF.
windows_vista coffeecoffee is offline     Reply With Quote
Thanked by:
Old 11-14-2009, 11:48 AM   #5
Bviper
LQ Newbie
 
Registered: Dec 2006
Distribution: Debian 5.0
Posts: 9
Thanked: 0

Original Poster
Y'all have been incredibly helpful, just to sum everything up:

No Swap

EXT2

Changes to /etc/fstab

/dev/"cf_card" / defaults,noatime,ro 0 0 - Changes the root file system to read only, and turns off file modification counts
none /tmp tmpfs defaults 0 0 - Changes the /tmp directory to a tmpfs
none /var/tmp tmpfs defaults 0 0 - Changes the /var/tmp directory to a tmpfs
none /var/log tmpfs defaults 0 0 - Changes the /var/log directory to a tmpfs

Changes to /etc/defaults/rcS

RAMRUN=yes - Changes the /var/run directory to a tmpfs
RUNOCK=yes - Changes the /var/lock directory to a tmpfs

and finally

"tune2fs -c 0 /dev/hdaxx" "and tune2fs -i 0 /dev/hdaxx" - Stops mount counts and interval between file system checks.

The only thing I don't really understand why is:
Quote:
-for the network you must change directory /etc/networking to /var/ (each boot, ifstate file)
Just have 2 more questions. Say I make all these changes, and want to run apt-get upgrade later will it work? Or will I have to change the / file system to read-write? This leads me into my next question, can I put everything in one partition(the default install)? Or do I need to have separate partions.

Last edited by Bviper; 11-14-2009 at 11:52 AM..
windows_vista Bviper is offline     Reply With Quote
Old 11-14-2009, 12:50 PM   #6
tredegar
Senior Member
 
Registered: May 2003
Location: London, UK
Distribution: Kubuntu6.06.1LTS (still excellent!). Kubuntu 8.04.1
Posts: 4,370
Thanked: 141
Before you start worrying too much about "wearing out" your memory, please check this link

I think some things will not work if / is mounted ro. You can experiment though. apt-get upgrade will certainly NOT work if / is mounted ro
linuxubuntu tredegar is offline     Reply With Quote
Old 11-15-2009, 08:05 AM   #7
dchost
LQ Newbie
 
Registered: Oct 2009
Posts: 10
Thanked: 2
"apt-get upgrade will certainly NOT work" = yes, that is true

i hade several cf-cards damaged with rw system so i choose read-only (desktop, state files, /tmp /var ...)



The network start script (/etc/rcS.d/SXXnetworking ) start the network
and write in the state file (/etc/network/run/ifstate) the existing interfaces.
If it is read-only the network wont start
(the simple way is to change directory to some rw place

rm -f /etc/network/run/ifstate
touch /var/run/ifstate
ln -s /var/run/ifstate /etc/network/run/ifstate


You can also remove some startup scripts (syslogd, ksyslogd, bootlgd). (in the /etc/rcS.d /etc/rc2.d)

You can use one or several partitions, as you want.
For the writing just make a simple script (like debian voyage dist)

touch /bin/remountrw
echo "mount -o remount,rw /" > /bin/remountw
chmod +x /bin/remountrw


(same thing for /bin/remountro)

Last edited by dchost; 11-15-2009 at 08:14 AM..
macos dchost is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
How do you duplicate a 512 Meg Compact flash to a 1 GB compact flash using dd??? allen00860 Linux - Newbie 5 05-23-2009 09:48 PM
Installing Ubuntu Server on a Compact Flash Card haroldjclements Linux - Newbie 1 05-15-2008 02:57 AM
Booting from a Compact Flash card FLLinux Linux - Newbie 16 06-10-2006 01:49 PM
Mounting a Compact Flash Card Kyl3 Slackware 3 05-26-2004 07:48 PM
PC Card, compact flash figadiablo Linux - Hardware 0 02-21-2003 09:56 PM


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

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration