Need to change endpoint of partition

I walked away from my computer while working in public, forgot i backed out of ssh and issued partition deletes to my local device.

i have the partition info but cant seem to find a way to change where my recovered partition ends without being sure that its not being overwritten.

its a LVM that testdisk only sees 2Mb of

Before fdisk output:

     Device: /dev/sda3
      Start: 2050048
        End: 250068991
    Sectors: 248018944
       Size: 118.3G
       Type: Linux filesystem
  Type-UUID: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
       UUID: A680800D-5FFA-4061-A7CA-E54C7A92A1D1

Current:

     Device: /dev/sda3
      Start: 2050048
        End: 2054143
    Sectors: 4096
  Cylinders: 1
       Size: 2M
         Id: 83
       Type: Linux
Start-C/H/S: 127/155/29
  End-C/H/S: 127/220/29  

as far as i see i just need to change where the partition ends??

you need to take down your partition info, then delete and recreate the partition. (in fdisk)

i have the info above (that is all)

its my LVM would this change anything?

Nope. Fdisk only messes with the partition table, not the actual data.

I’ve done this dozens of times on running production servers. Don’t sweat it.

you fdisk /dev/sda, delete the partition, create a new partition (make sure it’s the same partition number) then specify, manually, the start and end sectors, then set your flags and type to be the same as you had before, then write and quit fdisk.

ive been stranded at this coffee shop for 4 hours now.

my ass is sore ive been here so long.

my gosh, thanks man

1 Like

seems GRUB is gone or otherwise is not found by computer “no os found”

What distro are you running, and is the system on UEFI or BIOS?

ubuntu 18.04, BIOS

i dont think i ever had GRUB, it always just went right to password for diskcrypt

Edit:

sda1 is 500Mb fat32
sda2 is 500Mb ext2
sda3 is 118Gb LVM

Edit:

Tried boot-repair, did not work.

booting is just a boot loop

Shit, okay. I’m not super familiar with encrypted setups, but you’ll need to grub-install /dev/sda and then update-grub, both as root. (update-grub will need to be run from within a chroot, with proper bind mounts)

That should sort it out. (hopefully)