# How to minimize the number of writes to CF card?



## zhup (Aug 25, 2015)

Hello,
I am going to install FreeBSD on CF card and my question is:
how to minimize the number of writes to CF card?

Thank you in advance.


----------



## SirDice (Aug 25, 2015)

Ideally you'd use a read-only filesystem.


----------



## rabfulton (Aug 25, 2015)

Use tmpfs() for writable parts of the system. mount the rest read only.


----------



## wblock@ (Aug 25, 2015)

Disable logging.  But really, it depends on how the system will be used.  Will it be in some remote location?  Is the CF card expensive and hard to replace?  If so, some appliances create an mdmfs(8) drive at startup and run out of that.  The only writes to the main media are intentional ones.


----------



## cpm@ (Aug 25, 2015)

The OP has posted the same question on the freebsd-questions mailing list.


----------



## SirDice (Aug 25, 2015)

Some good advice there. Short version, make everything read-only, use tmpfs(5) for /tmp and perhaps an md(4) RAM disk for /var/.


----------



## wblock@ (Aug 25, 2015)

I think FreeNAS creates an mdmfs(8) drive on startup and runs from there, only saving configuration changes to the original media.  But a system like that can be a pain to try to use normally.


----------



## junovitch@ (Aug 26, 2015)

Keep nanobsd(8) in mind as well as it does some of the work for you.  Having two image partitions can be quite convenient if you find one is broken.  Set the old one as active again and reboot into it to get the system working again.  Netflix uses it as part of their OS upgrade process.  I just use it on my lowly little router but have found it quite convenient for the same reasons.

https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/nanobsd/index.html


----------

