樹莓派在配置openwrt編譯環境時遇到Structure needs cleaning錯誤。
百度各種解決方法無效,就自己分析錯誤提示,懷疑是SD卡磁盤格式錯誤。
安裝過樹莓派系統128G的SD卡在Windows下只顯示1.2G,無論怎么格式化只有這么大。在Windows下格式化重置樹莓派系統,繼續配置openwrt編譯環境仍然出錯Structure needs cleaning。

于是尋求在linux下格式化,沒有別的linux電腦,只能在另外一個8G的SD卡安裝樹莓派系統,將128G的SD裝入讀卡器,插入樹莓派進行格式化,格式過程如下:
1、查看磁盤信息
sudo fdisk -l
2、找到讀卡器掛載位置(此處換為8G SD卡做示例)
Disk /dev/sda: 7.2 GiB, 7744782336 bytes, 15126528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x267f1d86
Device Boot Start End Sectors Size Id Type
/dev/sda1 8192 137215 129024 63M c W95 FAT32 (LBA)
/dev/sda2 137216 15126527 14989312 7.2G 83 Linux
此上信息可以看出讀卡器掛載位置為/dev/sda,有兩個分區/dev/sda1和/dev/sda2
3、先卸載兩個分區:
umount /dev/sda1
umount /dev/sda2
4、然后格式化sda
mkfs.vfat /dev/sdb
如果出現如下錯誤:
mkfs.vfat: Device partition expected, not making filesystem on entire device '/dev/sdb' (use -I to override)
請使用:
mkfs.vfat -I /dev/sdb
格式化完成后,再安裝樹莓派系統進行openwrt編譯環境,就沒有Structure needs cleaning錯誤出現了。