I am aware of the huge amount of data recovery questions on this site, and reading all of them I think my case is unique enough to warrant a new question.

how it came to be

I set up a LVM with individual LV for each part of the system over two disks

$ lsblk
sda               8:0    0 931.5G  0 disk 
└─sda1            8:1    0 931.5G  0 part 
  └─datavg-data 254:4    0 543.8G  0 lvm  /data
sdb               8:16   0 111.8G  0 disk 
├─sdb1            8:17   0   487M  0 part /boot/efi
├─sdb2            8:18   0   244M  0 part /boot
└─sdb3            8:19   0 111.1G  0 part 
  ├─notapc-root 254:0    0   5.5G  0 lvm  /
  ├─notapc-usr  254:1    0   8.5G  0 lvm  /usr
  ├─notapc-var  254:2    0   4.8G  0 lvm  /var
  └─notapc-home 254:3    0  91.2G  0 lvm  /home

(I can give you the output of lvdisplay too, but I though it to long and unimportant

apt/dpkg started complaining about a lack of space on /var, / etc. so I decided to size them up. I also decided to decrease the size of my home partition, as most it was just symlinks (e.g. ~/Downloads to /data/username/Downloads/ anyway. So I just used lvreduce < whoops> before shrinking the filesystem < /whoops>. as expected, the filesystem could not be mounted on reboot. Since there was no important data I simply dd if=/dev/mapper/notapc-home of=/data/brokenhome.bak and made a new FS on the LV.

I later discovered that I never symlinked my projects folder to /data, which means it never landed on a Backup (I only backup /data), which made me really glad I dd'd it.

unfortunately I really struggled finding programs that could help me recover the partition. Testdisk would require my disk to still be intact, and I could not find more programs that can rebuild more than the partition table. Strings finds tons of stuff, which made me think maybe my project files could be recovered.

How do I recover a LVM LV partition with 2G missing from the end from a file image of the partition?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy