I have a completely standard, single hard drive Fedora 23 desktop. The dual-boot installer set up the Linux partition as LVM, with root, swap and home logical volumes; root and home were both ext4. Having recently added an additional 4 GB of ram, I decided to expand the swap volume by shrinking the home volume by 4 GB and then adding that to swap. Everything seemed to go fine, and my computer ran for several days with no problems.
However, I didn't reboot or shutdown after doing the above, and then there was a power failure. When I next booted up I was dropped into emergency recovery mode as the home ext4 volume was corrupted. I tried using fsck
several times, but was unable to fully repair the problem. I ended up reformatting the home volume and restoring from a recent backup.
My questions:
Was the corruption due to me screwing up the swap resizing, or due to not rebooting right after the resizing? The home filesystem had around 240 GB free when I shrank it by 4 GB, and it continued to be usable for several days afterwards, so I think I didn't screw it up, but that was the first time I've ever used LVM.
If I did the LVM stuff right and the problem was due to the power failure, was there any LVM command I could have issued to flush the changes to the hard drive, or is the only proper way to do it to reboot after the change?
resize2fs
on your home ext4 before shrinking it withlvresize
? – Anthon Apr 26 '16 at 4:46resize2fs
in any of the LVM how-tos I read. – Matthew Cline Apr 26 '16 at 6:28