I have a partition, say 190 GB, followed by 100 GB of unpartitioned disk free space.
I want to move this partition 100GB "to the right" (towards a higher sector number), so that the free unpartitioned free space would then be on the left of it.
This partition cannot just be copied carelessly, because:
- it contains encrypted data that must be preserved (on the block level),
- there is an overlap between the old and new position of the partition.
I know GParted should be able to handle this. However I would like to do it myself with command line tools. I know sfdisk has something like this to move partition 100M to the right:
echo '+100M,' | sfdisk --move-data /dev/sdc -N 1
I'd like to know 2 things:
- If I was to move data manually, using tools like
dd(or others), how would I do that? I believe the end of the partition must be copied before the start of it, like a backward read-and-copy (of course, I would also need to edit the GPT partition table). - If I want to use
sfdisk, how can I use it so that I shift by a very precise sector number, so that it properly "touches" the partition that is on the far end of the disk? (so that they are really next to each other with no gap in between)