翼度科技»论坛 云主机 LINUX 查看内容

磁盘问题和解决: fsck,gdisk,fdisk等

5

主题

5

帖子

15

积分

新手上路

Rank: 1

积分
15
错误: Resize inode not valid

对于gpt分区的硬盘一般fsck只能检查分区, 不能用于检查整个硬盘, 但是如果对硬盘设备运行时遇到这样的错误
  1. $ sudo fsck -n /dev/sdc
  2. fsck from util-linux 2.37.2
  3. e2fsck 1.46.5 (30-Dec-2021)
  4. GW1.5T was not cleanly unmounted, check forced.
  5. Resize inode not valid.  Recreate? no
复制代码
用 gdisk检查一下分区表, 可能会提示下面的信息
  1. $ sudo gdisk /dev/sdc
  2. GPT fdisk (gdisk) version 1.0.8
  3. Partition table scan:
  4.   MBR: MBR only
  5.   BSD: not present
  6.   APM: not present
  7.   GPT: not present
  8. ***************************************************************
  9. Found invalid GPT and valid MBR; converting MBR to GPT format
  10. in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
  11. typing 'q' if you don't want to convert your MBR partitions
  12. to GPT format!
  13. ***************************************************************
  14. Warning! Secondary partition table overlaps the last partition by
  15. 33 blocks!
  16. You will need to delete this partition or resize it in another utility.
复制代码
对于这种情况, 需要清空GPT和MBR, 命令 x -> z -> y * 2
  1. Command (? for help): x
  2. Expert command (? for help): z
  3. About to wipe out GPT on /dev/sdc. Proceed? (Y/N): y
  4. GPT data structures destroyed! You may now partition the disk using fdisk or
  5. other utilities.
  6. Blank out MBR? (Y/N): y
复制代码
之后再看就正常了
  1. $ sudo gdisk /dev/sdc
  2. GPT fdisk (gdisk) version 1.0.8
  3. Partition table scan:
  4.   MBR: not present
  5.   BSD: not present
  6.   APM: not present
  7.   GPT: not present
复制代码
用gdisk分区
  1. Command (? for help): n
  2. Partition number (1-128, default 1):
  3. First sector (34-2813066894, default = 2048) or {+-}size{KMGTP}:
  4. Last sector (2048-2813066894, default = 2813066894) or {+-}size{KMGTP}:
  5. Current type is 8300 (Linux filesystem)
  6. Hex code or GUID (L to show codes, Enter = 8300):
  7. Hex code or GUID (L to show codes, Enter = 8300):
  8. Changed type of partition to 'Linux filesystem'
  9. Command (? for help): w
  10. Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
  11. PARTITIONS!!
  12. Do you want to proceed? (Y/N): y
  13. OK; writing new GUID partition table (GPT) to /dev/sdc.
  14. The operation has completed successfully.
复制代码
分区之后, 会显示GPT信息
  1. $ sudo gdisk /dev/sdc
  2. GPT fdisk (gdisk) version 1.0.8
  3. Partition table scan:
  4.   MBR: protective
  5.   BSD: not present
  6.   APM: not present
  7.   GPT: present
  8. Found valid GPT with protective MBR; using GPT.
复制代码
错误: Bad magic number in super-block

如果用fsck直接检查GPT分区的硬盘时就会报这个错误
  1. $ sudo fsck -n /dev/sdc
  2. fsck from util-linux 2.37.2
  3. e2fsck 1.46.5 (30-Dec-2021)
  4. ext2fs_open2: Bad magic number in super-block
  5. fsck.ext2: Superblock invalid, trying backup blocks...
  6. fsck.ext2: Bad magic number in super-block while trying to open /dev/sdc
复制代码
需要指定文件系统对应的分区进行检查
  1. $ sudo fsck -n /dev/sdc1
  2. fsck from util-linux 2.37.2
  3. e2fsck 1.46.5 (30-Dec-2021)
  4. 1T4B: clean, 11/87908352 files, 5800552/351633105 blocks
复制代码
如果需要检查硬盘, 用 gdisk /dev/sdc, 然后在里面用 v 命令
错误 ata1: irq_stat 0x00400000, PHY RDY changed

在N2 NS-1 (CPU:hi3798mv200)上挂载一块 SanDisk ECO 1.92T SSD 时, 在dmesg中每隔100秒出现如下错误
  1. [  360.673489] ata1: exception Emask 0x10 SAct 0x0 SErr 0x10000 action 0xe frozen
  2. [  360.679463] ata1: irq_stat 0x00400000, PHY RDY changed
  3. [  360.683343] ata1: SError: { PHYRdyChg }
  4. [  360.685977] ata1: hard resetting link
  5. [  370.720684] ata1: softreset failed (device not ready)
  6. [  370.724476] ata1: hard resetting link
  7. [  375.681723] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
  8. [  375.684718] ata1.00: configured for UDMA/133
  9. [  375.684745] ata1: EH complete
复制代码
根据网上搜索到的结果, 大部分原因为: 供电问题, 硬盘硬件问题, 以及文件格式错误. 参考 https://forums.gentoo.org/viewtopic-t-815278.html
将整块SSD重新格式化为ext4后, 未再报错.

来源:https://www.cnblogs.com/milton/p/17559007.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

举报 回复 使用道具