

With a tool such as ddrescue which can copy in reverse, you could simplify this slightly: Resize the file system again so it occupies all the partition.

You’ll need to calculate the offsets and sizes based on what you did in step 2, but the target is easy ( /dev/sdX1). Copy the raw blocks from the second half of the disk to the newly-created partition, again using dd or something similar.Use GPT for this you’ll be overwriting blocks at the start and end of the disk, so the copy of the file system at the start of the disk is now toast. Partition the disk, creating one partition which is slightly larger than the file system (500G).

