viernes, 11 de diciembre de 2015

bringing to life a deadly XFS partition

This kind of post makes me feel really happy because it could helps anyone when the things looks pretty bad and for the joy to solve an issue I needed to fix.

Long long long time ago I had a problem with one HDD, it had two partitions, one of them was an ext4 and the other one was an XFS, I was copying more than 400 GB of data but an energy outage happened and the partitions became corrupted;`  as a result, I could not read the entire HDD, I had important data in there so I have to recover them.

I think the most important step to accomplish this task is to be calm as much as you may; by that time, I had a lot of stuff in progress, my job, an outsource IT project, and teaching at university, I had to wait around 8 months to start working on this, so, avoiding that comment, these steps were really helpful for me:

1. plug your HDD using an enclosure
2. You may a distro called System Rescue CD, it has a programm called testdisk, so boot your computer using that distro
3. an important step was to make sure if the filesystem is recognize by the OS, SystemRescueCD has a programm called "Display Filesystems", I used it and I could see the filesystem on my broken HDD, one ext4 and the other the XFS one.
4. next step I tried to mount the partitions but I got and input/output error then I decided to use testdisk.
5. Using testdisk I found I had a problem with the geometry of the HDD, you have to choose to do a "quick search" test in order to fix this, then you need to write the changes made to the disk
6. I decided to do a Deep Search to the disk, this was not necessary because at this time I could mount the partition but one of them could not be written, but using this option you could list the files that are in the partition and save it to a safe location.
7. As I wrote, at this point the partitions could be mounted but the XFS one couldn't be written, I still got an input/output error, the ext4 did not present any problem at all.
8. There is an utility called xfs_repair, you may install it using "apt-get install xfsprogs", after that I use this line:
xfs_repair -L /dev/location_of_the_partition

and that's it, xfs_repair found some zombie inodes, it moved them to lost+found and the process was successful.

Then I tried to mount it and everything works perfect, I could backup my data.

Hope it may help you in case on emergency.

No hay comentarios:

Publicar un comentario