I seem to have corrupted my primary LVM partition [1] which contains root and swap partitions.
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00025e8d
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 2099199 2097152 1G 83 Linux
/dev/sdb2 39051264 468862127 429810864 205G 5 Extended
/dev/sdb5 39053312 468860927 429807616 205G 8e Linux LVM
gparted says this about /dev/sdb5:
Unable to detect file system! Possible reasons are:
- The file system is damaged
- The file system is unknown to GParted
- There is no file system available (unformatted)
- The device entry /dev/sdb5 is missing
The system doesn't seem able to find the LVM partitions at all:
$ sudo vgchange -ay ubuntu-vg
Volume group "ubuntu-vg" not found
Cannot process volume group ubuntu-vg
$ sudo lvscan -av
Using logical volume(s) on command line.
No volume groups found.
How can I go about fixing /dev/sdb5?
I'm currently running gpart on /dev/sdb to see if that helps. fsck
doesn't work:
$ sudo fsck /dev/sdb5
fsck from util-linux 2.27.1
e2fsck 1.42.13 (17-May-2015)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb5
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
I believe the original filesystem on /dev/sdb5 was "lvm2 pv", and I have the option to format /dev/sdb5 as that via gparted, but before I make things worse, I thought I would ask here.
[1]: I was adding extra space to my boot partition when I corrputed this. I was following directions here, here, and here. This is roughly the order I did things in (to the best of my memory)
- I reduced ubuntu-vg/root by a couple GBs to free up some space
- I tried to
pvmove
ubuntu-vg/swap, but it complained about not having enough space - I reduced ubuntu-vg/root some more
- I
p4move
d ubuntu-vg/swap to push the unallocated space to the end of /dev/sdb2 - I used KDE Partition Manager to move /dev/sdb5 to the end of /dev/sdb2, so that the unallocated space is at the beginning of /dev/sdb2
- I tried to have KDE partition manager then shrink /dev/sdb2 to free up the unallocated space for /dev/sdb1, but it errored out on that operation. I opened gparted, and it told me to reboot, so I did
- I opened gparted, and shrunk /dev/sdb2 and grew /dev/sdb1. This is when I noticed that had an error on /dev/sdb5