I was trying to shrink my home partition. I followed this ArchWiki article for that. According to this I first resized my filesystem using resize2fs and then resized my physical device using parted. In resize2fs parameter I gave my intended size as XG and after resizing, it reported that new size is Y (4k blocks). From this info I calculated my partition size is (Y * 4) KiB and when resizing physical partition using parted I used this size. But in reality it is (Y * 4) KB. So now total block number of the filesystem is higher than the total block number of the physical device.
In resize2fs man page it is stated that if size isn't specified it will take up whole space from the device. So to solve this problem I ran resize2fs again so that it match the fs size with physical size. But it gave following error:
resize2fs 1.45.6 (20-Mar-2020) Resizing the filesystem on /dev/sda3 to 159907584 (4k) blocks. resize2fs: Can't read a block bitmap while trying to resize /dev/sda3 Please run 'e2fsck -fy /dev/sda3' to fix the filesystem after the aborted resize operation. But when I issue e2fsck it reported the mismatch and suggested to abort. So, now I am stuck in a loop:
e2fsck 1.45.6 (20-Mar-2020) The filesystem size (according to the superblock) is 186122240 blocks The physical size of the device is 159907584 blocks Either the superblock or the partition table is likely to be corrupt! Abort<y>? Is there any way to recover from this? Is it safe to mount and access the partition so that I can take backup?
Thanks!