0

I need to move (shift) an ext4 partition on my disk in a headless Linux machine, like this:

Before:
[######### Partition #########][- Free space -]

After:
[- Free space -][######### Partition #########]

This task is straightforward when using GParted, however any advices I've found for headless hosts consist of installing a VNC server and Gparted with all of its dependencies. I can not believe that there is no unix-way console tool for moving partitions around or a manual for doing the same with dd or something similar. Any thoughts please?

1 Answers1

1

How about just plain parted? It have move as one of its operations. Have a look at the manual here.

All you need to do is figure out exactly where the partition should start in the moved state, i.e. the offset from the beginning of the disk (in megabytes).