Recovering a corrupt LVM partition











up vote
0
down vote

favorite












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 p4moved 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










share|improve this question






















  • gpart didn't seem to discover anything.
    – Jeffrey
    Dec 2 at 0:01















up vote
0
down vote

favorite












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 p4moved 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










share|improve this question






















  • gpart didn't seem to discover anything.
    – Jeffrey
    Dec 2 at 0:01













up vote
0
down vote

favorite









up vote
0
down vote

favorite











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 p4moved 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










share|improve this question













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 p4moved 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







partitioning gparted data-recovery lvm fsck






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 1 at 20:31









Jeffrey

166113




166113












  • gpart didn't seem to discover anything.
    – Jeffrey
    Dec 2 at 0:01


















  • gpart didn't seem to discover anything.
    – Jeffrey
    Dec 2 at 0:01
















gpart didn't seem to discover anything.
– Jeffrey
Dec 2 at 0:01




gpart didn't seem to discover anything.
– Jeffrey
Dec 2 at 0:01















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1097743%2frecovering-a-corrupt-lvm-partition%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1097743%2frecovering-a-corrupt-lvm-partition%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ellipse (mathématiques)

Quarter-circle Tiles

Mont Emei