揮発性のメモ2

知識をメモ書きしておく

スーパーブロックの修復

壊れたSDのイメージを吸い出して、同じくらいのサイズの別SDに丸コピーして調査を

# fsck -n /dev/sda2
fsck from util-linux 2.29.2
e2fsck 1.43.4 (31-Jan-2017)
Warning: skipping journal recovery because doing a read-only filesystem check.
The filesystem size (according to the superblock) is 221688 blocks
The physical size of the device is 220664 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort? no

/dev/sda2 contains a file system with errors, check forced.
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
/dev/sda2: 18/55440 files (0.0% non-contiguous), 7843/221688 blocks

スーパーブロックが壊れてるとか言われたときは、ちゃんとした修復はできないのであきらめて適当な修復をおこなう

# mke2fs -S /dev/sdb2                                          
mke2fs 1.43.4 (31-Jan-2017)                                                     
/dev/sdb2 contains a ext3 file system                                           
        last mounted on Sat Jan  1 00:00:08 2000                                
Proceed anyway? (y,N) y                                                         
Creating filesystem with 220664 4k blocks and 55216 inodes                      
Filesystem UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx                           
Superblock backups stored on blocks:                                            
        32768, 98304, 163840                                                    
                                                                                
Allocating group tables: done                                                   
/dev/sdb2 may be further corrupted by superblock rewrite                        
Proceed anyway? (y,N) y                                                         
Writing superblocks and filesystem accounting information: done                 
# fsck -y /dev/sdb2                                            
fsck from util-linux 2.29.2                                                     
e2fsck 1.43.4 (31-Jan-2017)                                                     
/dev/sdb2 contains a file system with errors, check forced.                     
Resize inode not valid.  Recreate? yes                                          
                                                                                
Pass 1: Checking inodes, blocks, and sizes                                      
The bad block inode looks invalid.  Clear? yes                                  
                                                                                
Root inode is not a directory.  Clear? yes                                      
後略

致命的そうな大量のエラーが景気良く直っていくので、諦観して待つ

大事なファイルを lost+found から拾って終わり


linuxjm.osdn.jp