Quantcast
Viewing all articles
Browse latest Browse all 11

Recovery of the File System from Disaster

Hey Guys, long time no see…Well i am back and this time the issue is File System.

What Happened ?

Well My Backup Server’s root partition ran out of space due to some issue, and since it was on LVM (Logical Volume Manager) i took some space from my /home partition (it was 400 GB ) and added to my root partition. Following commands were used to resize the partition.

umount /dev/mapper/centos-home

lvreduce -L 200G /dev/mapper/centos-home

Note first i unmounted the partition and then reduced the space from my /home partition which was mounted as /centos-home
I took 200 GB out of it and added to my root partition.

The Mistake: I forgot to remount /home to /dev/mapper/centos-home

But i extended the partition with the following command:

lvextend -r -l+100%FREE /dev/mapper/centos-root

As per above command the partition will be re-sized to the 100% free space available from the reduced volume. Of course it was 200 GB. All was good when i saw the partition sized changed from no space to +200 GB. But then i realized that i was not able to mount /home to /centos-home and that was the time when all problem started. I “Rebooted The Machine” and when it came back it refused to enter the normal boot prompt but went into “Emergency mode”

Things i Tried:

I tried to fix the partition with xfs_repair tool , but in vain , and i received the error that “Cannot Find Super Block “

I tried to run the fixes couple of time but failed every time.

The Fix:

I fixed the issue by the following commands:

lvremove /dev/mapper/centos-home
lvcreate -L 200GB -n home centos

mkfs.xfs /dev/centos/home

mount /dev/mapper/centos-home

Luckily there was no important data on my /home partition and i was able to save my server.

Good Practice:

If you every fall prey to such situation, remember to “Backup” to an external drive and then proceed with the above mentioned technique to rescue yourself from such difficult situation.

I hope it will help some one some where, Let me know with your feedback.

Thanks & Best Regards,

Salman A. Francis


Viewing all articles
Browse latest Browse all 11

Trending Articles