요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Geometry, flags, and identity
sysfs-class-mtd:45-107Erase region, OOB·전체 size, flag bit, /proc/mtd 이름과 ASCII device type을 제공합니다.
Write and ECC geometry
sysfs-class-mtd:109-186Media별 writesize, ECC strength·step과 -EUCLEAN을 결정하는 bitflip_threshold 의미를 설명합니다.
ECC and bad block counters
sysfs-class-mtd:188-224ECC failure·corrected bit와 bad·BBT reserved block counter를 구분합니다.
Partition offset and OOB
sysfs-class-mtd:226-242Partition을 식별하는 parent-relative byte offset과 client-available out-of-band byte를 제공합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
What: /sys/class/mtd/
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
The mtd/ class subdirectory belongs to the MTD subsystem
(MTD core).
What: /sys/class/mtd/mtdX/
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
The /sys/class/mtd/mtd{0,1,2,3,...} directories correspond
to each /dev/mtdX character device. These may represent
physical/simulated flash devices, partitions on a flash
device, or concatenated flash devices.
What: /sys/class/mtd/mtdXro/
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
These directories provide the corresponding read-only device
nodes for /sys/class/mtd/mtdX/ .
What: /sys/class/mtd/mtdX/dev
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
Major and minor numbers of the character device corresponding
to this MTD device (in <major>:<minor> format). This is the
read-write device so <minor> will be even.
What: /sys/class/mtd/mtdXro/dev
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
Major and minor numbers of the character device corresponding
to the read-only variant of the MTD device (in
<major>:<minor> format). In this case <minor> will be odd.
What: /sys/class/mtd/mtdX/erasesize
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
"Major" erase size for the device. If numeraseregions is
zero, this is the eraseblock size for the entire device.
Otherwise, the MEMGETREGIONCOUNT/MEMGETREGIONINFO ioctls
can be used to determine the actual eraseblock layout.
What: /sys/class/mtd/mtdX/flags
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
A hexadecimal value representing the device flags, ORed
together:
0x0400: MTD_WRITEABLE - device is writable
0x0800: MTD_BIT_WRITEABLE - single bits can be flipped
0x1000: MTD_NO_ERASE - no erase necessary
0x2000: MTD_POWERUP_LOCK - always locked after reset
What: /sys/class/mtd/mtdX/name
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
A human-readable ASCII name for the device or partition.
This will match the name in /proc/mtd .
What: /sys/class/mtd/mtdX/numeraseregions
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
For devices that have variable eraseblock sizes, this
provides the total number of erase regions. Otherwise,
it will read back as zero.
What: /sys/class/mtd/mtdX/oobsize
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
Number of OOB bytes per page.
What: /sys/class/mtd/mtdX/size
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
Total size of the device/partition, in bytes.
What: /sys/class/mtd/mtdX/type
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
One of the following ASCII strings, representing the device
type:
absent, ram, rom, nor, nand, mlc-nand, dataflash, ubi, unknown
What: /sys/class/mtd/mtdX/writesize
Date: April 2009
KernelVersion: 2.6.29
Contact: [email protected]
Description:
Minimal writable flash unit size. This will always be
a positive integer.
In the case of NOR flash it is 1 (even though individual
bits can be cleared).
In the case of NAND flash it is one NAND page (or a
half page, or a quarter page).
In the case of ECC NOR, it is the ECC block size.
What: /sys/class/mtd/mtdX/ecc_strength
Date: April 2012
KernelVersion: 3.4
Contact: [email protected]
Description:
Maximum number of bit errors that the device is capable of
correcting within each region covering an ECC step (see
ecc_step_size). This will always be a non-negative integer.
In the case of devices lacking any ECC capability, it is 0.
What: /sys/class/mtd/mtdX/bitflip_threshold
Date: April 2012
KernelVersion: 3.4
Contact: [email protected]
Description:
This allows the user to examine and adjust the criteria by which
mtd returns -EUCLEAN from mtd_read() and mtd_read_oob(). If the
maximum number of bit errors that were corrected on any single
region comprising an ecc step (as reported by the driver) equals
or exceeds this value, -EUCLEAN is returned. Otherwise, absent
an error, 0 is returned. Higher layers (e.g., UBI) use this
return code as an indication that an erase block may be
degrading and should be scrutinized as a candidate for being
marked as bad.
The initial value may be specified by the flash device driver.
If not, then the default value is ecc_strength.
The introduction of this feature brings a subtle change to the
meaning of the -EUCLEAN return code. Previously, it was
interpreted to mean simply "one or more bit errors were
corrected". Its new interpretation can be phrased as "a
dangerously high number of bit errors were corrected on one or
more regions comprising an ecc step". The precise definition of
"dangerously high" can be adjusted by the user with
bitflip_threshold. Users are discouraged from doing this,
however, unless they know what they are doing and have intimate
knowledge of the properties of their device. Broadly speaking,
bitflip_threshold should be low enough to detect genuine erase
block degradation, but high enough to avoid the consequences of
a persistent return value of -EUCLEAN on devices where sticky
bitflips occur. Note that if bitflip_threshold exceeds
ecc_strength, -EUCLEAN is never returned by the read operations.
Conversely, if bitflip_threshold is zero, -EUCLEAN is always
returned, absent a hard error.
This is generally applicable only to NAND flash devices with ECC
capability. It is ignored on devices lacking ECC capability;
i.e., devices for which ecc_strength is zero.
What: /sys/class/mtd/mtdX/ecc_step_size
Date: May 2013
KernelVersion: 3.10
Contact: [email protected]
Description:
The size of a single region covered by ECC, known as the ECC
step. Devices may have several equally sized ECC steps within
each writesize region.
It will always be a non-negative integer. In the case of
devices lacking any ECC capability, it is 0.
What: /sys/class/mtd/mtdX/ecc_failures
Date: June 2014
KernelVersion: 3.17
Contact: [email protected]
Description:
The number of failures reported by this device's ECC. Typically,
these failures are associated with failed read operations.
It will always be a non-negative integer. In the case of
devices lacking any ECC capability, it is 0.
What: /sys/class/mtd/mtdX/corrected_bits
Date: June 2014
KernelVersion: 3.17
Contact: [email protected]
Description:
The number of bits that have been corrected by means of the
device's ECC.
It will always be a non-negative integer. In the case of
devices lacking any ECC capability, it is 0.
What: /sys/class/mtd/mtdX/bad_blocks
Date: June 2014
KernelVersion: 3.17
Contact: [email protected]
Description:
The number of blocks marked as bad, if any, in this partition.
What: /sys/class/mtd/mtdX/bbt_blocks
Date: June 2014
KernelVersion: 3.17
Contact: [email protected]
Description:
The number of blocks that are marked as reserved, if any, in
this partition. These are typically used to store the in-flash
bad block table (BBT).
What: /sys/class/mtd/mtdX/offset
Date: March 2015
KernelVersion: 4.1
Contact: [email protected]
Description:
For a partition, the offset of that partition from the start
of the parent (another partition or a flash device) in bytes.
This attribute is absent on flash devices, so it can be used
to distinguish them from partitions.
What: /sys/class/mtd/mtdX/oobavail
Date: April 2018
KernelVersion: 4.16
Contact: [email protected]
Description:
Number of bytes available for a client to place data into
the out of band area.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
MTD subsystem class
1-7| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/ |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | mtd/ class 하위 directory는 MTD subsystem(MTD core)에 속합니다. |
MTD device instance
9-17| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/ |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | /sys/class/mtd/mtd{0,1,2,3,...} directory는 각 /dev/mtdX character device에 대응합니다. Physical 또는 simulated flash device, flash device의 partition, concatenated flash device를 나타낼 수 있습니다. |
MTD class instance와 character device, read-only variant의 대응입니다.
Read-only MTD device
19-25| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdXro/ |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | /sys/class/mtd/mtdX/에 대응하는 read-only device node를 제공합니다. |
Read-write device number
27-34| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/dev |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | 이 MTD device에 대응하는 character device의 major와 minor 번호를 <major>:<minor> 형식으로 제공합니다. Read-write device이므로 <minor>는 짝수입니다. |
Read-only device number
36-43| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdXro/dev |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | MTD device의 read-only variant에 대응하는 character device의 major와 minor 번호를 <major>:<minor> 형식으로 제공합니다. 이 경우 <minor>는 홀수입니다. |
Read-write와 read-only device node의 minor parity를 구분합니다.
Major erase size
45-53| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/erasesize |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Device의 major erase size입니다. numeraseregions가 0이면 전체 device의 eraseblock size입니다. 그렇지 않으면 MEMGETREGIONCOUNT와 MEMGETREGIONINFO ioctl로 실제 eraseblock layout을 확인할 수 있습니다. |
MTD device flags
55-66| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/flags |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Device flag를 bitwise OR한 hexadecimal 값을 제공합니다. 정의된 flag는 MTD_WRITEABLE, MTD_BIT_WRITEABLE, MTD_NO_ERASE, MTD_POWERUP_LOCK입니다. |
원문에 나열된 hexadecimal flag와 의미입니다.
MTD device name
68-74| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/name |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Device 또는 partition의 사람이 읽을 수 있는 ASCII 이름입니다. /proc/mtd의 이름과 일치합니다. |
Erase region count
76-83| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/numeraseregions |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Eraseblock size가 가변인 device에서는 전체 erase region 수를 제공합니다. 그렇지 않으면 0을 읽습니다. |
OOB bytes per page
85-90| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/oobsize |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Page마다 존재하는 OOB byte 수입니다. |
Device or partition size
92-97| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/size |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Device 또는 partition의 전체 크기를 byte 단위로 제공합니다. |
Erase geometry와 전체 byte 크기를 제공하는 기본 속성입니다.
MTD device type
99-107| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/type |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Device type을 나타내는 ASCII 문자열 하나를 제공합니다. 가능한 값은 absent, ram, rom, nor, nand, mlc-nand, dataflash, ubi, unknown입니다. |
원문에 열거된 ASCII device type을 그대로 보존합니다.
Minimal writable unit
109-123| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/writesize |
| Date | 2009년 4월 |
| KernelVersion | 2.6.29 |
| Contact | [email protected] |
| Description | Flash의 minimum writable unit size이며 항상 양의 integer입니다. |
원문의 media별 writesize 설명을 구조화했습니다.
ECC correction strength
125-134| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/ecc_strength |
| Date | 2012년 4월 |
| KernelVersion | 3.4 |
| Contact | [email protected] |
| Description | ECC step 하나가 덮는 각 region 안에서 device가 교정할 수 있는 bit error의 maximum 개수입니다. ecc_step_size도 참조하십시오. 항상 음이 아닌 integer입니다. |
ECC capability가 없는 device에서는 0입니다.
ECC bitflip warning threshold
136-174| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/bitflip_threshold |
| Date | 2012년 4월 |
| KernelVersion | 3.4 |
| Contact | [email protected] |
| Description | mtd_read()와 mtd_read_oob()가 -EUCLEAN을 반환하는 기준을 user가 확인하고 조정할 수 있게 합니다. ECC step을 구성하는 단일 region 중 하나에서 교정된 bit error의 maximum 개수가 driver 보고 기준으로 이 값 이상이면 -EUCLEAN을 반환합니다. 그렇지 않고 error가 없으면 0을 반환합니다. UBI 같은 higher layer는 이 return code를 erase block이 저하되고 있으며 bad block 후보로 면밀히 조사해야 한다는 신호로 사용합니다. |
초기값은 flash device driver가 지정할 수 있습니다. 지정하지 않으면 기본값은 ecc_strength입니다.
이 기능 도입으로 -EUCLEAN return code의 의미가 미묘하게 바뀌었습니다. 이전에는 단순히 하나 이상의 bit error가 교정되었다는 뜻이었지만, 이제는 ECC step을 구성하는 하나 이상의 region에서 위험할 정도로 많은 bit error가 교정되었다는 뜻입니다. User는 bitflip_threshold로 위험 기준을 정밀하게 조정할 수 있지만 device 특성을 깊이 이해하지 못한다면 권장하지 않습니다. 일반적으로 실제 erase block 저하를 감지할 만큼 낮으면서 sticky bitflip이 생기는 device에서 -EUCLEAN이 지속적으로 반환되는 결과를 피할 만큼 높아야 합니다. bitflip_threshold가 ecc_strength보다 크면 read operation은 -EUCLEAN을 반환하지 않습니다. 반대로 bitflip_threshold가 0이면 hard error가 없는 한 항상 -EUCLEAN을 반환합니다.
일반적으로 ECC capability가 있는 NAND flash device에만 적용됩니다. ecc_strength가 0인 ECC capability가 없는 device에서는 무시합니다.
ECC step의 region별 교정 bit 수를 threshold와 비교하는 read 결과입니다.
Threshold와 ecc_strength 관계가 -EUCLEAN 반환에 미치는 영향입니다.
ECC step size
176-186| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/ecc_step_size |
| Date | 2013년 5월 |
| KernelVersion | 3.10 |
| Contact | [email protected] |
| Description | ECC가 덮는 단일 region의 크기이며 ECC step이라고 합니다. Device는 writesize region마다 크기가 같은 ECC step을 여러 개 가질 수 있습니다. |
항상 음이 아닌 integer입니다. ECC capability가 없는 device에서는 0입니다.
ECC failure count
188-197| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/ecc_failures |
| Date | 2014년 6월 |
| KernelVersion | 3.17 |
| Contact | [email protected] |
| Description | 이 device의 ECC가 보고한 failure 수입니다. 보통 failed read operation과 관련됩니다. |
항상 음이 아닌 integer입니다. ECC capability가 없는 device에서는 0입니다.
ECC corrected bit count
199-208| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/corrected_bits |
| Date | 2014년 6월 |
| KernelVersion | 3.17 |
| Contact | [email protected] |
| Description | Device의 ECC로 교정된 bit 수입니다. |
항상 음이 아닌 integer입니다. ECC capability가 없는 device에서는 0입니다.
Bad block count
210-215| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/bad_blocks |
| Date | 2014년 6월 |
| KernelVersion | 3.17 |
| Contact | [email protected] |
| Description | 이 partition에서 bad로 표시된 block이 있다면 그 개수를 제공합니다. |
Reserved BBT block count
217-224| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/bbt_blocks |
| Date | 2014년 6월 |
| KernelVersion | 3.17 |
| Contact | [email protected] |
| Description | 이 partition에서 reserved로 표시된 block이 있다면 그 개수를 제공합니다. 보통 in-flash bad block table(BBT)을 저장하는 데 사용합니다. |
ECC와 bad block 관련 누적·현재 counter를 구분합니다.
Partition offset
226-234| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/offset |
| Date | 2015년 3월 |
| KernelVersion | 4.1 |
| Contact | [email protected] |
| Description | Partition에서 parent 시작점으로부터 해당 partition의 offset을 byte 단위로 제공합니다. Parent는 다른 partition 또는 flash device일 수 있습니다. Flash device에는 이 속성이 없으므로 partition과 구분하는 데 사용할 수 있습니다. |
속성 유무로 partition과 flash device를 구분할 수 있습니다.
Client-available OOB bytes
236-242| 항목 | 한국어 전문 번역 |
|---|---|
| What | /sys/class/mtd/mtdX/oobavail |
| Date | 2018년 4월 |
| KernelVersion | 4.16 |
| Contact | [email protected] |
| Description | Client가 out-of-band area에 data를 넣을 수 있도록 사용할 수 있는 byte 수입니다. |
전체 page OOB와 client가 사용할 수 있는 부분을 구분합니다.
Class and device nodes
sysfs-class-mtd:1-43MTD instance와 read-only variant를 /dev/mtdX character device 및 even·odd minor 번호에 연결합니다.