Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been trying to setup a longlasting linux installation on one of the plug computers (SheevaPlug). Basically it's an embedded device with debian-based Linux ARM, which is booting from flash NAND memory chip. I would like to customize the setup a bit in order to extend the lifespan of the internal MTD and the device itself. The device is going to be running certain network services like samba/NAS (external USB HDD), SSH, FTP and the like. Generally I would want to have the device perform the least possible amount of writes to the internal flash to minimize memory degradation.
Any suggestions?
I came up with a few questions and ideas, but I am unsure what the best choices are.
Add "noatime,errors=remount-ro" to all local filesystems in fstab.
Which filesystem best to use? ext2, ext3, ext4, reiserfs, btrfs, jffs, fat, ubifs ???
The apt package manager had a huge cache of files on my MTD - when I ran apt-get clean about 250MB of packages got cleaned from the 512MB NAND device. That's a lot! Perhaps I can somehow disable caching?
Disable local logging. A lot of stuff gets written to /var/log. What to do about this? Redirect to external server?
How many folders should I mount in tmpfs? /tmp, /var/run, /var/lock, /dev/shm, /dev/pts ???, /var/log, /var/tmp, /var/spool, /var/cache Can I mount entire /var folder on tmpfs???
Deadline "The goal of the Deadline scheduler is to guarantee a start service time for a request"
Noop "The NOOP scheduler inserts all incoming I/O requests into a simple FIFO queue and implements request merging."
For your solid state devices the 'Noop' scheduler for each would be the best fit. Let your mechanical devices use the default 'CGQ' scheduler.
This how I setup my 'SSD' in '/etc/rc.d/rc.local';
Code:
#09-25-12 gws 20:07
#
#08-20-12 gws 14:38
#set minimum swappiness
#
echo 1 > /proc/sys/vm/swappiness
#08-20-12 gws
#sets scheduler for SSD to 'noop'
#SSD=(device ID's of all 'SSD': see note below)
#Note Information revised from ArchWiki;
#This provides the links listed with targets information to place in bash array
#'SSD= ( ) parentheses in below 'SSD= ( );
#ls -l /dev/disk/by-id
#lrwxrwxrwx 1 root root 9 Aug 19 11:27 ata-OCZ-AGILITY3_OCZ-C93VFN4X0532CVMP -> ../../sda
SSD=(ata-OCZ-AGILITY3_OCZ-C93VFN4X0532CVMP)
declare -i i=0
while [ "${SSD[$i]}" != "" ]; do
NODE=`ls -l /dev/disk/by-id/${SSD[$i]} | awk '{ print $NF }' | sed -e 's/[/\.]//g'`
echo noop > /sys/block/$NODE/queue/scheduler
i=i+1
done
#08-20-12 gws 14:45
#get some additional gain by setting up a write-back cache
hdparm -W1 /dev/sda #where x= a,b,c,d...
#
#09-20-12:16:14 gws bumblebee
#setup for video switch for Intel or Optimus
if [ -x /etc/rc.d/rc.bumblebeed ]; then
/etc/rc.d/rc.bumblebeed start
fi
Thank you for the hint. It's not a real SSD I'm using, it's an internal NAND flash chip that is soldered onto the circuit board of my SheevaPlug.
Here's a fstab I came up with. It could use some improvements though. I'm not 100% certain about the use of parameters i.e. is noexec a good idea on /tmp? I read somewhere that certain programs will break/not run because of it.
Anyway, I did some research on the fstab and file systems. It would seem that a UBIFS is indeed a good choice for a raw flash device. There were some changes made to my fstab. The ubifs does not support noatime parameter, so it was removed. There shouldn't be a need for a remount "ro" on errors because this is already done in UBIFS automatically by design. I also removed the commit line because it doesn't change much.
/var/run is symlinked to /run
/var/lock is symlinked to /run/lock
/dev/shm is symlinked to /run/shm
I'm currently trying to figure out whether it is sensible to include these mountpoints in tmpfs.
/var/cache
/var/mail
/var/spool
The apt-get is giving me some puke whenever I mount /var/cache (or /var/cache/apt) as tmpfs. Perhaps I should only mount /var/cache/apt/archives? But the apt folder is definitely going to have to be mounted, because apt stores all downloaded packages in here - this can consume a lot of space when you're not 'apt-get clean'-ning your system after installing stuff. not to mention useless flash writes.
I was thinking that 'UBIFS' used a 'FTL(File Translation Layer)' therefore was a 'mtdblock' device. After clearing things up for myself, it turns out that a raw device would be degraded using a 'FTL' technique with 'UBI'. Sorry!
I could swear that apt moaned about not finding certain stuff inside /var/cache/apt last time I used it, but after reinstall it seems to work. I replaced the fsck flag from 1 to 0 on the rootfs. Having a 1 there causes fsck to run on boot and fail because fsck.ubifs doesn't exist. I disabled .bash_history and nano history.
EDIT2: Changed permissions of /var/log to 1777 as some services complain they have no write access to this folder. Also, should you be running nginx, a folder /var/log/nginx has to be created before nginx starts. Else it will complain that it cannot open log files and exit. the script /etc/init.d/nginx should be edited to create the folder automatically.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.