You are not logged in.

#1 2026-03-23 01:30:52

ikidy
Member
Registered: 2026-03-23
Posts: 8

Recovering broken lvm2 partitions

Hello everyone! I'm in a bit of a tough situation. I was trying to add more storage to my home logical volume, and I accidentally deleted my efi partition. I immediately realized the issue after a reboot and booted into a live iso. I tried to allocate 512mb of space at the start of my first SSD. The partition to the right of it was one I had just made to expand my storage, and was empty. This seemed to break my home lv. I tried a bunch of things I can't remember to fix it, and I just can't get my home lv mountable anymore. Every time I do, I get an error about ext4 superblocks. I tried forcibly removing the empty partitions from my home lv, but that didn't help either. I haven't touched anything on my second drive, which is where all my data is. Here's what my current partition structure looks like:

Drive 1:
Efi partition
Home partition 1 (empty)
Root partition
Home partition 2 (empty)

Drive 2:
Home partition 3 (empty)
Root, home, swap partition
Root, home partition

I'm currently making a backup of the home partitions that had stuff on it, but so far I haven't had any luck mounting or reading anything from them. Any help is appreciated!

Last edited by ikidy (2026-03-23 01:43:39)

Offline

#2 2026-03-23 06:08:53

bebeto
Member
Registered: 2026-03-23
Posts: 2
Website

Re: Recovering broken lvm2 partitions

You most likely didn’t destroy your data - the problem is that by deleting/recreating partitions (especially adding space at the start of the disk), you broke the LVM mapping and partition offsets, which makes your ext4 filesystem look corrupted when it probably isn’t; the safest path is to stop making changes, boot a live system, run pvscan, vgscan, lvscan, then vgchange -ay to see if your volume group can be reactivated, and if it looks incomplete, restore LVM metadata using vgcfgrestore from /etc/lvm/archive/, after which you should attempt a read-only mount of the logical volume and only then consider superblock recovery or tools like testdisk if needed - focus on fixing LVM first, not ext4, because the filesystem errors are likely just a symptom of the broken volume layout.


Have a great day smile

Offline

#3 2026-03-23 08:04:25

frostschutz
Member
Registered: 2013-11-15
Posts: 1,636

Re: Recovering broken lvm2 partitions

Can't help you without knowing exactly what you did. "I tried a bunch of things I can't remember", "I get an error about" is not very helpful. Post specific commands, error messages, outputs...

Show lsblk ... if your root partition still works, there should be LVM metadata in /etc/lvm/, post those if possible.

Alternatively if your partitions are still detected as LVM, metadata is in the 1st 1MiB, you can probably grab it with `head -c 1M /dev/partition | strings -n 32 -w`. If that gives any results that includes "# Generated by LVM2", "logical_volumes {" kind of strings, post the whole thing.

Offline

#4 2026-03-24 00:05:44

ikidy
Member
Registered: 2026-03-23
Posts: 8

Re: Recovering broken lvm2 partitions

Thanks everyone for the replies!

bebeto wrote:

the safest path is to stop making changes, boot a live system, run pvscan, vgscan, lvscan, then vgchange -ay to see if your volume group can be reactivated, and if it looks incomplete, restore LVM metadata using vgcfgrestore from /etc/lvm/archive/

Thankfully, I was able to get this to work. I had previously used wipefs on the 3 new PVs I added, which were already empty, which caused lvm to complain about missing volumes. I restored from an archive before I added these partitions, so that's no longer a problem. Vgchange -ay works with no issues, but the problem is now mounting. I'm not able to mount either my root or my home LV. Trying gives this error:

mount: /mnt: wrong fs type, bad option, bad superblock on /dev/mapper/vg0-root, missing codepage or helper program, or other error.

Dmesg shows this:
bad geometry: block count 37341184 exceeds size of device (16777216 blocks)

Fsck mirrors this, and adds:
Either the superblock or the partition table is likely to be corrupt!

frostschutz wrote:

Alternatively if your partitions are still detected as LVM, metadata is in the 1st 1MiB, you can probably grab it with `head -c 1M /dev/partition | strings -n 32 -w`. If that gives any results that includes "# Generated by LVM2", "logical_volumes {" kind of strings, post the whole thing.

I believe my partitions are still detected as lvm. Running lsblk shows vg0-root, vg0-home, and vg0-swap under the partitions I expect it to. The LVs are also listed as type "lvm". Running the head command you sent just seems to return junk data. I'm not able to type it all out on my phone keyboard, so please bear with me. The only part that seems to not be junk is near the top of my home lv, with this but of text:

B!^ZmGQbH/home

My root lv doesn't show anything like this.

I'm going to refrain from running any commands until I'm absolutely sure they're safe, as impulsiveness is what got me in this situation. But from what I've seen online, it seems like the best course of action is to run fsck -f, then resize2fs on both LVs. Does that seem correct?

Last edited by ikidy (2026-03-24 00:37:55)

Offline

#5 2026-03-24 10:39:17

ikidy
Member
Registered: 2026-03-23
Posts: 8

Re: Recovering broken lvm2 partitions

I fixed it! Turns out lvm was expecting that my drives were still there, so it was expecting a larger block size. I added my empty partitions back, and stole some space from swap, as lvm was expecting space I had given to efi. After I could mount both home and root, I remade efi and successfully booted. Thank you everyone for your help!

Offline

Board footer

Powered by FluxBB