Support Articles

Repairing an XFS File System In Linux

This article is geared toward RHEL 7 and Centos 7 but should work on most distributions. I will include screen shots later.

Boot Linux cd or dvd and boot into rescue mode. Boot the cd or dvd and choose Troubleshooting. (Image1)

Image 1
Image 1

Once you hit enter with Troubleshooting hightlighted, choose Rescue a CentOS System. (Image2)

Image 2
Image 2

When the screen asks if you want to mount the file system under /mnt/sysimage, SKIP this step by tabbing to skip. (Image 3)

Image 3
Image 3

 

At the command prompt, type lvscan if it’s a logical volume, which it usually is, this will give you some output like; /dev/centos/root or /dev/mapper/centos-root or home. (Image 4)

Image 4
Image 4

Now at the command prompt type xfs_repair /dev/mapper/centos-root or whatever the name of the volume is that’s giving problems. You can repair all volumes, it won’t hurt a thing. (Image 5)

Image 5
Image 5

The result will look like this: (Image 6)

Image 6
Image 6

After repairing what you need, eject the cd or dvd and reboot.

If you still have a problem after this, you can repeat the steps but type xfs_repair -L -d then the volume name. These are dangerous options and you could lose data, but it m,ay also solve your file system corruption problems.

If you still have problems, I hope you remembered to back up.

Eric Evans

 

Hits: 74

Leave a Reply