houzi105
作者houzi105·2013-03-05 22:11
系统工程师·@@@

Fixing a corrupted magic number in the file system superblock

字数 4126阅读 7712评论 0赞 1
Fixing a corrupted magic number in the file system superblock

If the superblock of a file system is damaged, the file system cannot be accessed. You can fix a corrupted magic number in the file system superblock.

Most damage to the superblock cannot be repaired. The following procedure describes how to repair a superblock in a JFS file system when the problem is caused by a corrupted magic number. If the primary superblock is corrupted in a JFS2 file system, use the fsck command to automatically copy the secondary superblock and repair the primary superblock.

In the following scenario, assume /home/myfs is a JFS file system on the physical volume /dev/lv02.

The information in this how-to scenario was tested using specific versions of AIX®. The results you obtain might vary significantly depending on your version and level of AIX.
  1. Unmount the /home/myfs file system, which you suspect might be damaged, using the following command: umount /home/myfs
  2. To confirm damage to the file system, run the fsck command against the file system. For example: fsck -p /dev/lv02If the problem is damage to the superblock, the fsck command returns one of the following messages: fsck: Not an AIXV5 file systemOR Not a recognized filesystem type
  3. With root authority, use the od command to display the superblock for the file system, as shown in the following example: od -x -N 64 /dev/lv02 +0x1000Where the -x flag displays output in hexadecimal format and the -N flag instructs the system to format no more than 64 input bytes from the offset parameter (+), which specifies the point in the file where the file output begins. The following is an example output: 0001000 1234 0234 0000 0000 0000 4000 0000 000a 0001010 0001 8000 1000 0000 2f6c 7633 0000 6c76 0001020 3300 0000 000a 0003 0100 0000 2f28 0383 0001030 0000 0001 0000 0200 0000 2000 0000 0000 0001040
  4. In the preceding output, note the corrupted magic value at 0x1000 (1234 0234). If all defaults were taken when the file system was created, the magic number should be 0x43218765. If any defaults were overridden, the magic number should be 0x65872143.
  5. Use the od command to check the secondary superblock for a correct magic number. An example command and its output follows: $ od -x -N 64 /dev/lv02 +0x1f000 001f000 6587 2143 0000 0000 0000 4000 0000 000a 001f010 0001 8000 1000 0000 2f6c 7633 0000 6c76 001f020 3300 0000 000a 0003 0100 0000 2f28 0383 001f030 0000 0001 0000 0200 0000 2000 0000 0000 001f040Note the correct magic value at 0x1f000.
  6. Copy the secondary superblock to the primary superblock. An example command and output follows: $ dd count=1 bs=4k skip=31 seek=1 if=/dev/lv02 of=/dev/lv02 dd: 1+0 records in. dd: 1+0 records out.
  7. Use the fsck command to clean up inconsistent files caused by using the secondary superblock. For example: fsck /dev/lv02 2>&1 | tee /tmp/fsck.errs

For more information

修复 superblock.

1. For checking the Primary Superblock:

lquerypv -h /dev/lvname 1000 100    #Displays SuperBlock info for JFS

lquerypv -h /dev/lvname 8000 100    #Displays SuperBlock info for JFS2

2. For checking the Secondary Superblock:

lquerypv -h /dev/lvname 1F000 100   #Displays the Backup Copy of the Superblock for JFS

lquerypv -h /dev/lvname F000 100     #Displays the Backup Copy of the Superblock for JFS2

3. For coping the Secondary Superblock to the Primary Superblock:

dd count=1 bs=4k skip31 seek=1 if=/dev/LVName of=/dev/LVName -- JFS

dd count=1 bs=4k skip15 seek=8 if=/dev/LVName of=/dev/LVName -- JFS2

Copies the backup superblock to primary,use this if you can not write the superblock during fsck command. Then rerun fsck after this. You can use the -p option on the fsck command.

Use above dd by caution.

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

1

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

X社区推广