ubifs: why ubifs doesn't support 2 copied of super blocks for better fs reliability

Richard Weinberger richard at nod.at
Sat Jun 29 06:56:29 PDT 2024


----- Ursprüngliche Mail -----
> Von: "chengzhihao1" <chengzhihao1 at huawei.com>
> An: "Ryder Wang" <rydercoding at hotmail.com>, "linux-mtd" <linux-mtd at lists.infradead.org>, "richard" <richard at nod.at>
> Gesendet: Samstag, 29. Juni 2024 13:22:34
> Betreff: Re: ubifs: why ubifs doesn't support 2 copied of super blocks for better fs reliability

> 在 2024/6/28 10:28, Ryder Wang 写道:
>> Hello,
>> 
>> It looks ubifs has only 1 super block. Super block may be corrupted by power-cut

No. The super block must not get corrupted by a sudden loss of power.
If you're facing this, something else in your storage stack is broken.

>> while NAND erasing or writing, ECC error and etc. When super block is
>> corrupted, ubifs mount will always fail.
>> 
> 
> Have you met the problem caused by corrupted superblock? I only saw once
> in our product, in which there ware many problem eraseblocks in the flash.
> 
>> I am asking why ubifs doesn't support 2 copied of super blocks for better fs
>> reliability? As we know, both uibfs master block and ubi volume table have 2
>> copies, so they are very stronger. Is there any dev plan to support it on super
>> block?
> 
> I have no ideas about this question either after looking through the
> history and whitepaper[1]. The superblock is updated in a very low
> frequency(eg. auto-resize), and it is updated by atomic changing. So I
> guess that corrupted superblock is hardly generated from the view of
> UBIFS layer. However, the UBI will do wear-leveing, which could
> atomically exchange two LEBs(may contain superblock), then the updating
> frequency of superblock could be increased. The final probability of
> corrupted superblock is hard to say. So, I'm not sure it's a very
> valuable thing to maintain two superblocks in UBIFS, afterall, it will
> change disk structure.

UBIFS relies on working flash memory, so having multiple copies makes no sense
since one of UBIFS' goals is also being space efficient.
There is one exception: it has two master LEBs. For historic reasons,
it needs to exchange theirs contents automatically, at the time when UBIFS
was young, UBI had no atomic-leb-change feature.

Thanks,
//richard



More information about the linux-mtd mailing list