The perfect solution for ext file system repair under server Linux system

Summary: 1. Fault description The server is dell 730 series server, the storage array is MD3200 series storage 5T Lun, the operating system is Linux centos 7, and the file system type is EXT4. It can be started normally, but the mounted 5T partition cannot be accessed normally. Perform fsck repair on this 5T partition. After the repair is completed, the file system is normal, but some files are lost. After careful inspection, some missing files are in the lost+found folder Inside, the file name has been changed.

1. Fault description The
server is a dell 730 series server, the storage array is MD3200 series storage 5T Lun, the operating system is Linux centos 7, and the file system type is EXT4. Due to unexpected power failure, the system cannot start normally. After the repair, the system can be normal. Start, but the mounted 5T partition cannot be accessed normally. Perform fsck repair on this 5T partition. After the repair is completed, the file system is normal, but some files are lost. After careful inspection, some missing files are in the lost+found folder. The file name has been changed.
2. Failure analysis
1. Backup data Remap the 5T lun stored in
the MD3200 to a Windows 2008 backup server in read-only mode, and then use professional tools to mirror the entire 5T volume to the prepared volume in sectors. Backup space is used to ensure the safety of customers' data, and subsequent analysis and recovery operations are performed on the backed up data.
2. Analyze the cause of the failure
A careful analysis of the underlying data of the 5T volume found that the sudden power failure of the server resulted in the destruction of the directory entries in the directory of the faulty virtual machine, but this damage would not affect important data, but only destroy the directory entries of the files, which can be repaired manually. solvable. Afterwards, the file system is fsck repaired, resulting in unsuccessful repair of the damaged directory item. It is directly named after the directory node number and placed in the lost+found folder, then the data area index corresponding to the directory entry will be cleared, and it will not affect Delete the actual data of the file. In this case, fragment matching and merging can be performed in the free space of the VMFS volume according to the file system in the deleted virtual disk file and the file type in the virtual disk, and finally the deleted virtual disk file can be recovered.

3. Implementation direction
Because the node information of the file is cleared after the ext4 file system file is lost, it cannot be restored according to the node information of the file, but only according to the node number of the directory item of the lost file and the name of the file in lost+found For matching, since the files in lost+found are named after the node number of the directory entry of the file, the previous directory structure can be restored by extracting the node number of the directory entry and matching the file name of lost+found.

4. Restoring data
According to the implementation direction, the underlying analysis is carried out. According to the file system structure information of EXT4, the area of ​​the corresponding directory entry is scanned in the underlying space, and the number of the directory entry is counted and the node number of the directory entry is calculated. Then according to the information of the file system on the disk, the node numbers of the scanned directory items are integrated, and the node numbers of the scanned directory items are recorded in the database, and then the file record number in lost+found and the records in the database are recorded. number to match.

5. Recovery summary
Because the customer data was first powered off suddenly, causing a problem with the file system, and then the manual fsck repair resulted in the loss of a large number of file directory structures, and some data was rewritten, resulting in the possibility of data overwriting. Due to sufficient understanding of the underlying structure of the ext4 file system and experience in dealing with similar types of failures. So the whole recovery process was relatively smooth. After matching, the data is restored normally, and there is no problem with the verification, and the entire data is restored successfully.
timg_1_

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326224912&siteId=291194637