I added a partition to my LVM group on linux, but didn't back up the data that was on the disk before doing so. And now I can't mount the underling partition as /dev/sda4. Does anyone know how to get to that data. I have a music collection and other stuff on that partition that will be difficult to replace. Not smart, I know. Live and learn I guess.

This question came from our site for professional and enthusiast programmers.

...I can't mount: It might help if you mentioned how you are trying to mount the partition and what the error message is, along with some information, such as the filesystem type of the partition.
–
thkalaJan 17 '12 at 21:18

Oh, another extremely important question: was the partition added to a volume, was the filesystem of that volume extended to absorb the additional space, and did you modify anything in that volume's filesystem?
–
thkalaJan 17 '12 at 21:24

1 Answer
1

What was the filesystem type of the partition that you messed up? There are different recovery options for different filesystems.

How are you trying to mount the partition?

What is the error message produced by the mount failure?

There is also missing context about your mistake:

Apart from adding the partition to a volume group, did you extend a volume to include it?

Did you also resize the filesystem of that volume to include the additional space?

If so, what filesystem type was it? And, most importantly, was it in use?

If you are really lucky, the LVM superblock may have just overwritten the filesystem superblock. In that case you might be able to bring the filesystem to a more consistent state by forcing fsck to use one of the backup superblocks - provided that your filesystem actually supports that. You'd still lose data, but you'd probably also save quite a bit.

If you are unlucky, then you have already written stuff all over your partition and recovery will be a long, unpleasant and less than effective process.

PS: Before you try anything, use dd to keep an image of your partition. That ensures that you can reverse any failed attempt to repair your filesystem without making things worse.