Recover XFS File System Superblock experiment

Source: Internet
Author: User
Tags dmesg

1. Create an XFS file system
[Email protected] ~]# mkfs.xfs-f/DEV/VDB1
META-DATA=/DEV/VDB1 isize=256 agcount=4, agsize=1966102 blks
= sectsz=512 attr=2, projid32bit=0
data = bsize=4096 blocks=7864408, imaxpct=25
= Sunit=0 swidth=0 blks
Naming =version 2 bsize=4096 ascii-ci=0
Log =internal log bsize=4096 blocks=3840, version=2
= sectsz=512 sunit=0 Blks, lazy-count=1
Realtime =none extsz=4096 blocks=0, rtextents=0

[Email protected] ~]# Cat/etc/fstab |grep vdb1
/dev/vdb1/test XFS Defaults 0 0

[Email protected] ~]# mount-a

[Email protected] ~]# df-h
/DEV/VDB1 30G 610M 30G 2%/test

2. unmount the file system/test and destroy the Superblock
[Email protected] ~]# umount/test

[[email protected] ~]# dd If=/dev/zero of=/dev/vdb1 bs=512 count=1
1+0 Records in
1+0 Records out
Bytes (+ B) copied, 0.00251096 s, 204 kb/s

3. Mount the error again
[Email protected] ~]# mount-a
Mount:wrong fs type, bad option, bad Superblock on/dev/vdb1,
Missing codepage or helper program, or other error
In some cases useful info are found in Syslog-try
DMESG | Tail or so

[Email protected] ~]# DMESG
[22597379.623449] XFS (VDB1): Bad magic number
[22597379.624372] XFS (VDB1): SB Validate failed

4. Restore Superblock
[Email protected] ~]# XFS_REPAIR/DEV/VDB1
Phase 1-find and verify Superblock ...
Bad primary Superblock-bad magic number!!!

Attempting to find secondary superblock ...
..... found candidate secondary superblock ...
Verified Secondary Superblock ...
Writing modified primary Superblock
SB Realtime bitmap Inode 18446744073709551615 (nullfsino) inconsistent with calculated value 129
Resetting superblock realtime bitmap ino pointer to 129
SB Realtime Summary inode 18446744073709551615 (nullfsino) inconsistent with calculated value 130
Resetting Superblock Realtime Summary ino pointer to 130
Phase 2-using Internal Log
-Zero log ...
-Scan filesystem FreeSpace and Inode maps ...
Sb_icount 0, counted 64
Sb_ifree 0, counted 60
Sb_fdblocks 7860552, counted 7712768
-Found root inode chunk
Phase 3-for each AG ...
-Scan and clear agi unlinked lists ...
-Process known inodes and perform inode discovery ...
-Agno = 0
-Agno = 1
-Agno = 2
-Agno = 3
-Process newly discovered inodes ...
Phase 4-check for duplicate blocks ...
-Setting up duplicate extent list ...
-Check for inodes claiming duplicate blocks ...
-Agno = 0
-Agno = 1
-Agno = 2
-Agno = 3
Phase 5-rebuild AG headers and trees ...
-Reset Superblock ...
Phase 6-check inode Connectivity ...
-Resetting contents of realtime bitmap and summary inodes
-Traversing filesystem ...
-Traversal finished ...
-Moving disconnected inodes to lost+found ...
Phase 7-verify and correct link counts ...
Note-stripe Unit (0) and width (0) fields has been reset.
Please set with Mount-o sunit=<value>,swidth=<value>
Done

5. Confirm that you have recovered
[Email protected] ~]# mount-a
[Email protected] ~]# df-h
/DEV/VDB1 30G 610M 30G 2%/test

Recover XFS File System Superblock experiment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.