Linux下SD卡不可靠?

Linux下SD卡不可靠?

我在 Linux 下写入 SD 卡时遇到严重(且可重复)的问题。

背景:

  • 我正在开发一个嵌入式系统,使用 SD 卡作为根文件系统。
  • 我经常看到 fsck 错误。
  • 我以为我们的硬件有问题。
  • 文件系统是ext3.

问题:

即使在 PC 上(相当新的 KUbuntu,如果重要的话)我也会看到错误。举个例子:

$ sudo fsck.ext3 -fvy /dev/sdb2 && sudo mount /dev/sdb2 /mnt && sudo tar xf rootfs_01.02.tar -C /mnt/ && sync && sleep 2 && sudo umount /dev/sdb2 && sleep 2 && sudo fsck.ext3 -fvy /dev/sdb2
e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

        3388 inodes used (2.58%, out of 131072)
         208 non-contiguous files (6.1%)
           0 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 210/2/0
       56844 blocks used (10.84%, out of 524288)
           0 bad blocks
           1 large file

        2518 regular files
         323 directories
           0 character device files
           0 block device files
           0 fifos
          33 links
         538 symbolic links (538 fast symbolic links)
           0 sockets
------------
        3412 files
e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found.  Fix? yes

Inode 32964 was part of the orphaned inode list.  FIXED.
Inode 65552 was part of the orphaned inode list.  FIXED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

root: ***** FILE SYSTEM WAS MODIFIED *****

        3388 inodes used (2.58%, out of 131072)
         213 non-contiguous files (6.3%)
           0 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 210/2/0
       56841 blocks used (10.84%, out of 524288)
           0 bad blocks
           1 large file

        2518 regular files
         323 directories
           0 character device files
           0 block device files
           0 fifos
          33 links
         538 symbolic links (538 fast symbolic links)
           0 sockets
------------
        3412 files

对于多个 SD、两个不同的 SD 卡 USB 适配器和两台 PC(相同的发行版),都会出现这种情况。

有人看到过这样的事情吗?

我不敢相信 Linux SD 处理是所以越野车。

我应该检查什么?

答案1

这种情况发生在不干净的删除或关闭时。我还建议使用ext4。

相关内容