You are on page 1of 3

5/3/2017 Fixing a corrupted magic number in the file system superblock

Fixing a corrupted magic number in the file


system superblock
Versio… 

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/lv02

If the problem is damage to the superblock, the fsck command returns one of the following messages:

fsck: Not an AIXV5 file system

OR

Not a recognized filesystem type

https://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.howtos/HT_baseadmn_badmagnumber.htm 1/3
5/3/2017 Fixing a corrupted magic number in the file system superblock

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 +0x1000

Where 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

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.

4. 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 
001f040

Note the correct magic value at 0x1f000.

5. 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.

6. Use the fsck command to clean up inconsistent files caused by using the secondary superblock. For
example:

https://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.howtos/HT_baseadmn_badmagnumber.htm 2/3
5/3/2017 Fixing a corrupted magic number in the file system superblock

fsck /dev/lv02 2>&1 | tee /tmp/fsck.errs

Parent topic:
 Storage management (Logical Volume Manager)

https://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.howtos/HT_baseadmn_badmagnumber.htm 3/3

You might also like