/tmp, /var/log, /var/tmp as /dev/md - why?

John-Mark Gurney jmg at funkthat.com
Wed Jul 2 11:38:58 UTC 2014


Anton Shterenlikht wrote this message on Wed, Jul 02, 2014 at 09:32 +0100:
> >From imp at bsdimp.com Tue Jul  1 18:09:59 2014
> >
> >On Jul 1, 2014, at 3:25 AM, Anton Shterenlikht <mexas at bris.ac.uk> wrote:
> >
> >> Why is it a good idea to mount /tmp and some var dirs on memory disks:
> >>=20
> >> root at raspberry-pi:/usr/ports # df -m
> >> Filesystem     1M-blocks Used Avail Capacity  Mounted on
> >> /dev/mmcsd0s2a     14694  777 12742     6%    /
> >> devfs                  0    0     0   100%    /dev
> >> /dev/mmcsd0s1         16    3    13    20%    /boot/msdos
> >> /dev/md0              28    4    22    16%    /tmp
> >> /dev/md1              14    0    12     0%    /var/log
> >> /dev/md2               4    0     4     0%    /var/tmp
> >> root at raspberry-pi:/usr/ports #=20
> >>=20
> >> Is this about speed or power, or maybe space?
> >>=20
> >> Can I not put all these dirs on sd card?
> >>=20
> >> I'm new to arm, so maybe things are different
> >> to other arches.
> >
> >It isn=92t so much about ARM as it is about SD cards. Each write to a =
> >file causes wear and tear on the card. Each update of metadata likewise. =
> >There are things that can be done (like enabling trim) that reduce the =
> >wear and tear on the card, NAND flash only has so much life. Do you =
> >really want to use it for data that=92s at best disposable? No. SD cards =
> >these days are made from NAND that=92s lucky to get 3k separate writes =
> >to it (or even worse: 500 in the case of TLC NAND). Given such a limited =
> >resource, nanobsd, and others, use MD devices to eliminate that wear and =
> >tear. It is the same rason there=92s no swap partition...
> >
> >Having said that, I=92ve run many development systems without doing =
> >this. They work fine, but doing it in production has shown to result in =
> >some SD cards (not all) breaking prematurely.
> >
> >Warner
> 
> Wow, thank you!
> 
> I knew nothing about sd cards, so this is very helpful.
> 
> So, if I need to build kernel, world and ports often,
> sd card is a poor choice? I better use an external disk?

If often, you mean once a week, then probably you'll be fine w/ SD
cards...  If often you mean in a continuous loop, you still might
be fine as long as your life time of the SD card is fine at a couple
years, partly because w/ how slow ARM compiles code, you wouldn't
be writing that much data out...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-arm mailing list