← Documents Documentation/ABI/stable/sysfs-class-ubi GitHub 원문 ↗

Linux 6.18.37 · ABI / stable

UBI class stable sysfs ABI

UBI on-media version, device별 logical·physical eraseblock와 bad-block reserve, read-only mode, volume alignment·type·corruption·update marker를 설명합니다.

Source pathDocumentation/ABI/stable/sysfs-class-ubi
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

UBI class와 format version

sysfs-class-ubi:1-31

UBI 전체 정보와 device·volume directory, 향후 backward-compatible format versioning을 다룹니다.

UBI device attribute

sysfs-class-ubi:33-132

Available·total·bad eraseblock, background thread, character device, I/O 단위, MTD 번호, bad-block reserve와 read-only 상태를 다룹니다.

UBI volume attribute

sysfs-class-ubi:134-221

Volume alignment, corruption, data size, reserved eraseblock, dynamic·static type, update marker와 usable eraseblock size를 다룹니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 What: /sys/class/ubi/
2 Date: July 2006
3 KernelVersion: 2.6.22
4 Contact: Artem Bityutskiy <dedekind@infradead.org>
5 Description:
6 The ubi/ class sub-directory belongs to the UBI subsystem and
7 provides general UBI information, per-UBI device information
8 and per-UBI volume information.
9
10 What: /sys/class/ubi/version
11 Date: July 2006
12 KernelVersion: 2.6.22
13 Contact: Artem Bityutskiy <dedekind@infradead.org>
14 Description:
15 This file contains version of the latest supported UBI on-media
16 format. Currently it is 1, and there is no plan to change this.
17 However, if in the future UBI needs on-flash format changes
18 which cannot be done in a compatible manner, a new format
19 version will be added. So this is a mechanism for possible
20 future backward-compatible (but forward-incompatible)
21 improvements.
22
23 What: /sys/class/ubiX/
24 Date: July 2006
25 KernelVersion: 2.6.22
26 Contact: Artem Bityutskiy <dedekind@infradead.org>
27 Description:
28 The /sys/class/ubi0, /sys/class/ubi1, etc directories describe
29 UBI devices (UBI device 0, 1, etc). They contain general UBI
30 device information and per UBI volume information (each UBI
31 device may have many UBI volumes)
32
33 What: /sys/class/ubi/ubiX/avail_eraseblocks
34 Date: July 2006
35 KernelVersion: 2.6.22
36 Contact: Artem Bityutskiy <dedekind@infradead.org>
37 Description:
38 Amount of available logical eraseblock. For example, one may
39 create a new UBI volume which has this amount of logical
40 eraseblocks.
41
42 What: /sys/class/ubi/ubiX/bad_peb_count
43 Date: July 2006
44 KernelVersion: 2.6.22
45 Contact: Artem Bityutskiy <dedekind@infradead.org>
46 Description:
47 Count of bad physical eraseblocks on the underlying MTD device.
48
49 What: /sys/class/ubi/ubiX/bgt_enabled
50 Date: July 2006
51 KernelVersion: 2.6.22
52 Contact: Artem Bityutskiy <dedekind@infradead.org>
53 Description:
54 Contains ASCII "0\n" if the UBI background thread is disabled,
55 and ASCII "1\n" if it is enabled.
56
57 What: /sys/class/ubi/ubiX/dev
58 Date: July 2006
59 KernelVersion: 2.6.22
60 Contact: Artem Bityutskiy <dedekind@infradead.org>
61 Description:
62 Major and minor numbers of the character device corresponding
63 to this UBI device (in <major>:<minor> format).
64
65 What: /sys/class/ubi/ubiX/eraseblock_size
66 Date: July 2006
67 KernelVersion: 2.6.22
68 Contact: Artem Bityutskiy <dedekind@infradead.org>
69 Description:
70 Maximum logical eraseblock size this UBI device may provide. UBI
71 volumes may have smaller logical eraseblock size because of their
72 alignment.
73
74 What: /sys/class/ubi/ubiX/max_ec
75 Date: July 2006
76 KernelVersion: 2.6.22
77 Contact: Artem Bityutskiy <dedekind@infradead.org>
78 Description:
79 Maximum physical eraseblock erase counter value.
80
81 What: /sys/class/ubi/ubiX/max_vol_count
82 Date: July 2006
83 KernelVersion: 2.6.22
84 Contact: Artem Bityutskiy <dedekind@infradead.org>
85 Description:
86 Maximum number of volumes which this UBI device may have.
87
88 What: /sys/class/ubi/ubiX/min_io_size
89 Date: July 2006
90 KernelVersion: 2.6.22
91 Contact: Artem Bityutskiy <dedekind@infradead.org>
92 Description:
93 Minimum input/output unit size. All the I/O may only be done
94 in fractions of the contained number.
95
96 What: /sys/class/ubi/ubiX/mtd_num
97 Date: January 2008
98 KernelVersion: 2.6.25
99 Contact: Artem Bityutskiy <dedekind@infradead.org>
100 Description:
101 Number of the underlying MTD device.
102
103 What: /sys/class/ubi/ubiX/reserved_for_bad
104 Date: July 2006
105 KernelVersion: 2.6.22
106 Contact: Artem Bityutskiy <dedekind@infradead.org>
107 Description:
108 Number of physical eraseblocks reserved for bad block handling.
109
110 What: /sys/class/ubi/ubiX/ro_mode
111 Date: April 2016
112 KernelVersion: 4.7
113 Contact: linux-mtd@lists.infradead.org
114 Description:
115 Contains ASCII "1\n" if the read-only flag is set on this
116 device, and "0\n" if it is cleared. UBI devices mark themselves
117 as read-only when they detect an unrecoverable error.
118
119 What: /sys/class/ubi/ubiX/total_eraseblocks
120 Date: July 2006
121 KernelVersion: 2.6.22
122 Contact: Artem Bityutskiy <dedekind@infradead.org>
123 Description:
124 Total number of good (not marked as bad) physical eraseblocks on
125 the underlying MTD device.
126
127 What: /sys/class/ubi/ubiX/volumes_count
128 Date: July 2006
129 KernelVersion: 2.6.22
130 Contact: Artem Bityutskiy <dedekind@infradead.org>
131 Description:
132 Count of volumes on this UBI device.
133
134 What: /sys/class/ubi/ubiX/ubiX_Y/
135 Date: July 2006
136 KernelVersion: 2.6.22
137 Contact: Artem Bityutskiy <dedekind@infradead.org>
138 Description:
139 The /sys/class/ubi/ubiX/ubiX_0/, /sys/class/ubi/ubiX/ubiX_1/,
140 etc directories describe UBI volumes on UBI device X (volumes
141 0, 1, etc).
142
143 What: /sys/class/ubi/ubiX/ubiX_Y/alignment
144 Date: July 2006
145 KernelVersion: 2.6.22
146 Contact: Artem Bityutskiy <dedekind@infradead.org>
147 Description:
148 Volume alignment - the value the logical eraseblock size of
149 this volume has to be aligned on. For example, 2048 means that
150 logical eraseblock size is multiple of 2048. In other words,
151 volume logical eraseblock size is UBI device logical eraseblock
152 size aligned to the alignment value.
153
154 What: /sys/class/ubi/ubiX/ubiX_Y/corrupted
155 Date: July 2006
156 KernelVersion: 2.6.22
157 Contact: Artem Bityutskiy <dedekind@infradead.org>
158 Description:
159 Contains ASCII "0\n" if the UBI volume is OK, and ASCII "1\n"
160 if it is corrupted (e.g., due to an interrupted volume update).
161
162 What: /sys/class/ubi/ubiX/ubiX_Y/data_bytes
163 Date: July 2006
164 KernelVersion: 2.6.22
165 Contact: Artem Bityutskiy <dedekind@infradead.org>
166 Description:
167 The amount of data this volume contains. This value makes sense
168 only for static volumes, and for dynamic volume it equivalent
169 to the total volume size in bytes.
170
171 What: /sys/class/ubi/ubiX/ubiX_Y/dev
172 Date: July 2006
173 KernelVersion: 2.6.22
174 Contact: Artem Bityutskiy <dedekind@infradead.org>
175 Description:
176 Major and minor numbers of the character device corresponding
177 to this UBI volume (in <major>:<minor> format).
178
179 What: /sys/class/ubi/ubiX/ubiX_Y/name
180 Date: July 2006
181 KernelVersion: 2.6.22
182 Contact: Artem Bityutskiy <dedekind@infradead.org>
183 Description:
184 Volume name.
185
186 What: /sys/class/ubi/ubiX/ubiX_Y/reserved_ebs
187 Date: July 2006
188 KernelVersion: 2.6.22
189 Contact: Artem Bityutskiy <dedekind@infradead.org>
190 Description:
191 Count of physical eraseblock reserved for this volume.
192 Equivalent to the volume size in logical eraseblocks.
193
194 What: /sys/class/ubi/ubiX/ubiX_Y/type
195 Date: July 2006
196 KernelVersion: 2.6.22
197 Contact: Artem Bityutskiy <dedekind@infradead.org>
198 Description:
199 Volume type. Contains ASCII "dynamic\n" for dynamic volumes and
200 "static\n" for static volumes.
201
202 What: /sys/class/ubi/ubiX/ubiX_Y/upd_marker
203 Date: July 2006
204 KernelVersion: 2.6.22
205 Contact: Artem Bityutskiy <dedekind@infradead.org>
206 Description:
207 Contains ASCII "0\n" if the update marker is not set for this
208 volume, and "1\n" if it is set. The update marker is set when
209 volume update starts, and cleaned when it ends. So the presence
210 of the update marker indicates that the volume is being updated
211 at the moment of the update was interrupted. The later may be
212 checked using the "corrupted" sysfs file.
213
214 What: /sys/class/ubi/ubiX/ubiX_Y/usable_eb_size
215 Date: July 2006
216 KernelVersion: 2.6.22
217 Contact: Artem Bityutskiy <dedekind@infradead.org>
218 Description:
219 Logical eraseblock size of this volume. Equivalent to logical
220 eraseblock size of the device aligned on the volume alignment
221 value.
222

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

UBI class와 on-media format version

1-21

/sys/class/ubi/는 UBI subsystem의 class subdirectory로 일반 UBI 정보, UBI device별 정보와 UBI volume별 정보를 제공한다. 2006년 7월 kernel 2.6.22에 도입됐고 담당자는 Artem Bityutskiy <dedekind@infradead.org>다.

/sys/class/ubi/version은 지원하는 최신 UBI on-media format version을 담는다. 현재 값은 1이며 바꿀 계획은 없다. 향후 호환 방식으로 처리할 수 없는 on-flash format 변경이 필요하면 새 version을 추가한다. 따라서 이 값은 backward-compatible하지만 forward-incompatible할 수 있는 미래 개선을 위한 mechanism이다.

UBI device directory

23-31

/sys/class/ubi0, /sys/class/ubi1 등의 directory는 UBI device 0, 1 등을 설명한다. 일반 UBI device 정보와 UBI volume별 정보를 포함하며 UBI device 하나는 여러 UBI volume을 가질 수 있다.

Eraseblock와 device capacity

33-108

별도 표시가 없는 아래 attribute는 2006년 7월 kernel 2.6.22에 도입됐고 담당자는 Artem Bityutskiy다.

경로의미
/sys/class/ubi/ubiX/avail_eraseblocks사용 가능한 logical eraseblock 수다. 예를 들어 이 수만큼 logical eraseblock을 가진 새 UBI volume을 만들 수 있다.
/sys/class/ubi/ubiX/bad_peb_countUnderlying MTD device의 bad physical eraseblock 수다.
/sys/class/ubi/ubiX/bgt_enabledUBI background thread가 disabled면 ASCII 0\n, enabled면 ASCII 1\n이다.
/sys/class/ubi/ubiX/dev이 UBI device에 대응하는 character device의 major·minor를 <major>:<minor> 형식으로 표시한다.
/sys/class/ubi/ubiX/eraseblock_size이 UBI device가 제공할 수 있는 최대 logical eraseblock size다. Volume alignment 때문에 UBI volume은 더 작은 logical eraseblock을 가질 수 있다.
/sys/class/ubi/ubiX/max_ecPhysical eraseblock erase counter의 최댓값이다.
/sys/class/ubi/ubiX/max_vol_count이 UBI device가 가질 수 있는 최대 volume 수다.
/sys/class/ubi/ubiX/min_io_size최소 I/O unit size다. 모든 I/O는 이 값의 배수 단위로만 수행할 수 있다.
/sys/class/ubi/ubiX/mtd_numUnderlying MTD device number다. 2008년 1월 kernel 2.6.25에 도입됐다.
/sys/class/ubi/ubiX/reserved_for_badBad-block handling을 위해 reserve한 physical eraseblock 수다.

Read-only 상태와 device 전체 수

110-132
경로도입·담당의미
/sys/class/ubi/ubiX/ro_mode2016년 4월 · kernel 4.7 · linux-mtd@lists.infradead.orgDevice read-only flag가 설정됐으면 ASCII 1\n, 해제됐으면 0\n이다. UBI device는 복구할 수 없는 error를 감지하면 스스로 read-only로 표시한다.
/sys/class/ubi/ubiX/total_eraseblocks2006년 7월 · kernel 2.6.22 · Artem BityutskiyUnderlying MTD device에서 bad로 표시되지 않은 good physical eraseblock의 전체 수다.
/sys/class/ubi/ubiX/volumes_count2006년 7월 · kernel 2.6.22 · Artem Bityutskiy이 UBI device의 volume 수다.

UBI volume identity, alignment와 data

134-192

/sys/class/ubi/ubiX/ubiX_0/, ubiX_1/ 등의 directory는 UBI device X의 volume 0, 1 등을 설명한다. 아래 attribute는 2006년 7월 kernel 2.6.22에 도입됐고 담당자는 Artem Bityutskiy다.

경로의미
.../alignmentVolume logical eraseblock size가 정렬돼야 하는 값이다. 2048이면 logical eraseblock size가 2048의 배수다. 즉 UBI device logical eraseblock size를 volume alignment 값에 맞춘 결과다.
.../corruptedUBI volume이 정상이면 ASCII 0\n, 중단된 volume update 등의 이유로 손상됐으면 ASCII 1\n이다.
.../data_bytesVolume이 담은 data 양이다. Static volume에서 의미가 있으며 dynamic volume에서는 전체 volume byte size와 같다.
.../dev이 UBI volume에 대응하는 character device의 major·minor를 <major>:<minor>로 표시한다.
.../nameVolume 이름이다.
.../reserved_ebs이 volume을 위해 reserve한 physical eraseblock 수다. Logical eraseblock 단위 volume size와 같다.

Volume type, update marker와 usable eraseblock

194-221
경로의미
/sys/class/ubi/ubiX/ubiX_Y/typeDynamic volume은 ASCII dynamic\n, static volume은 static\n이다.
/sys/class/ubi/ubiX/ubiX_Y/upd_markerUpdate marker가 없으면 ASCII 0\n, 있으면 1\n이다. Volume update 시작 때 set하고 끝나면 clear한다.
/sys/class/ubi/ubiX/ubiX_Y/usable_eb_size이 volume의 logical eraseblock size다. Device logical eraseblock size를 volume alignment 값에 맞춘 결과와 같다.

upd_marker가 있으면 volume update가 현재 진행 중이거나 update가 중단됐다는 뜻이다. 중단 여부와 손상 상태는 corrupted sysfs file로 확인할 수 있다.