Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 2014 08:49:22 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: /tmp, /var/log, /var/tmp as /dev/md - why?
Message-ID:  <8756CB42-0B1B-4191-8A63-9D54FEE5D877@bsdimp.com>
In-Reply-To: <20140702022042.GG45513@funkthat.com>
References:  <CADL2u4g65eo=7xxAt9j8JumyWneouhM2MGpcA9kfxJaCFWg95Q@mail.gmail.com> <201407011046.s61AkJpj006890@mech-cluster241.men.bris.ac.uk> <20140702022042.GG45513@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_BCF575E8-B9A5-4E90-AF57-EAF27CE0393B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


On Jul 1, 2014, at 8:20 PM, John-Mark Gurney <jmg@funkthat.com> wrote:

> Anton Shterenlikht wrote this message on Tue, Jul 01, 2014 at 11:46 =
+0100:
>>> =46rom r.c.ladan@gmail.com Tue Jul  1 11:37:35 2014
>>>=20
>>> 2014-07-01 11:25 GMT+02:00 Anton Shterenlikht <mexas@bris.ac.uk>:
>>>=20
>>>> Why is it a good idea to mount /tmp and some var dirs on memory =
disks:
>>>>=20
>>>> root@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@raspberry-pi:/usr/ports #
>>>>=20
>>>> Is this about speed or power, or maybe space?
>>>>=20
>>>> Mostly write tear because you're using an SD card, and it improves =
speed
>>> too.
>>=20
>> "write tear"?
>> Is this a joke, or some technical term?
>> I cannot find what it means.
>=20
> it is a technical term, though I'd be surprised if any SD card had
> an issue w/ that anymore=85

SD cards are made from NAND flash. NAND flash is different than a hard =
disk in that it has only a limited number of times you can write to a =
given spot before it becomes unusable (well, hard drives have this too, =
but the numbers are huge (1e20 or something like that if memory serves). =
This number can be as low as a few hundred for the really low-end cheap =
crap parts, but typically is a few thousand. The reason for this is =
because you have to erase each NAND page before you can program it, and =
each time you erase it you expose the cell to a huge negative potential =
voltage. This leads to trapping of electrons, as well as some minor =
physical damage, usually along tiny flaws in the manufacturing process. =
The net effect is that the dynamic range of the cell is reduced, which =
leads to errors which eventually get bad enough that the pages become =
useless. Since there=92s actual physical damage to each program/erase =
cycle, it is referred to as =93wear and tear.=94 You=92ll see references =
to =93wear leveling=94 which attempts to wear out each block at about =
the same rate.


> write tear is where when writing data, only part of the data gets
> written and then you loose power...  This is mostly an issue on flash
> where you have to erase the data beforey ou can program it...  Most
> flash now have a layer of indirection so that they copy/write the
> data to a new flash block, and then point the block there before
> erasing the old data... (kinda like a log FS)=85

Yes, nearly all block devices based on flash have some kind of log-based =
system under the covers. It is a shame they don=92t expose the log =
directly, since a number of interesting optimizations could be made in =
host software that are not possible going through the translation layer =
a log-bsed system imposes on the card. But we get what we get...

Warner

--Apple-Mail=_BCF575E8-B9A5-4E90-AF57-EAF27CE0393B
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJTtBvyAAoJEGwc0Sh9sBEARMwP/jg2oo8B1pcn2rXvmkv8/FbJ
4Qcgr3VPrEoU6lKkbpBdbRPJN9lG+TSqZu0YT3ie6cG9bQ7A+Y5cc2a4zr+pav02
HeFsOU0IMsvZj1eePhaAS6Zz4naw3ZLG/9bE8sORCLMhXv2kKmyMg2Vi4PILq36m
sMG1yRV+3ohP0YZ0enJwoAZ8h1HGrl/emOlXQgVL1+E2F5r8YGnWE0XgRc3n9qi2
lDGVVxQCRkLlTge8W+Fkh5lxqb1e0Tj4A8zpnhko/XkriFlM8nkn5vm6hfBHbqHW
9D61QxPoFnJa6sE0rB0wNpPk7D26njA0GoRKvNAcm6waBajlabZEDSPGif88oZv9
tshflFG4Z7AgCU03R2sv3w9fkKSR2NpAQOvjhMxUeBI26PXuY4KrnFu6aa8LeMVd
/HjyM6kyUehOzCARGHDt1yGKAG9OSpQQqh8Fkai/kVY4OcGERPYf+OtAkqx25Ymj
+cTihDVXlsVtO+OVAICqB6teeMWsZXOPEar1RmN+wCjHNstwdMnpt1Q7ud9kgxOW
d/plyvwVkg0ulYvZa69sUrF8fe1XgErgLsW2ZX1wV968C5FNaCaoJB9df2a4M1ib
BZA9TW2mtclzulMp5u4xcHCrqhL97sUkco7pE1K0EVJqOQtKNw4KSvENr/YrXb+k
yPU18zre1L9bwvaUegon
=igD5
-----END PGP SIGNATURE-----

--Apple-Mail=_BCF575E8-B9A5-4E90-AF57-EAF27CE0393B--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8756CB42-0B1B-4191-8A63-9D54FEE5D877>