LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 11-08-2009, 07:15 PM   #1
Bviper
LQ Newbie
 
Registered: Dec 2006
Distribution: Debian 5.0
Posts: 14

Rep: Reputation: 0
Installing Debian to a compact flash card


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.
 
Old 11-08-2009, 07:33 PM   #2
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,057

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
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
 
Old 11-11-2009, 04:07 PM   #3
dchost
LQ Newbie
 
Registered: Oct 2009
Posts: 18

Rep: Reputation: 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.
 
Old 11-12-2009, 05:59 AM   #4
coffeecoffee
Member
 
Registered: Feb 2009
Posts: 58

Rep: Reputation: 16
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.
 
Old 11-14-2009, 11:48 AM   #5
Bviper
LQ Newbie
 
Registered: Dec 2006
Distribution: Debian 5.0
Posts: 14

Original Poster
Rep: Reputation: 0
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.
 
Old 11-14-2009, 12:50 PM   #6
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 5,995

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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
 
Old 11-15-2009, 08:05 AM   #7
dchost
LQ Newbie
 
Registered: Oct 2009
Posts: 18

Rep: Reputation: 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.
 
Old 11-28-2009, 12:37 PM   #8
Bviper
LQ Newbie
 
Registered: Dec 2006
Distribution: Debian 5.0
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by dchost View Post
You can also remove some startup scripts (syslogd, ksyslogd, bootlgd). (in the /etc/rcS.d /etc/rc2.d)
Is this necessary if / is going to be mounted as read only? The logs shouldn't really matter.
 
Old 11-28-2009, 04:33 PM   #9
dchost
LQ Newbie
 
Registered: Oct 2009
Posts: 18

Rep: Reputation: 2
i think it's better, anyway it will make some error messages "unable to write..."
i only have few basic rc scripts, like hostname, proc, basic mount -a ...
(faster boot, made this way 5,5 seconds boot with matchbox-window-manager+idesk)

to do it simple: juste make some OLD directory and move all of the symbolic links ( that you don't need) from rcS.d and rc2.d
to the OLD directory (easier than update-rc.d)
and if you need them back you can just move them from "OLD" to initial place
(DON'T move the udev script)

You can also mount you log directory to tmpfs
fstab:
none /var/log tmpfs defaults 0 0
(and the created logs will be present until the next reboot or shutdown)
 
Old 12-01-2009, 02:29 AM   #10
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Etch/Lenny/Squeeze
Posts: 3,337

Rep: Reputation: 286Reputation: 286Reputation: 286
Check this:
http://debian-live.alioth.debian.org/

It looks like a good starting point, you can adapt according to your needs.

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 02:31 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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration