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?

  • @CristianCiupitu great, that's what I was looking for. Indeed, I should have asked at Superuser. Can you please post your comment as an answer so I could mark it accepted? –  May 06 '15 at 13:03
  • I'm glad that you found what you were looking for. Thank you for the intention of giving me some points, but there's no need for it, since I believe that this question belongs on Super User and voted accordingly (you can probably vote for this too since it's your own question). – Cristian Ciupitu May 06 '15 at 13:29

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).

MrMajestyk
  • 176
  • 5
  • 2
    Thank you, that's a good suggestion, however, after reading the [documentation for the current version](http://www.gnu.org/software/parted/manual/parted.html#Command-explanations) I found that the option has been removed: "Note that after version 2.4, the following commands were removed: check, cp, mkfs, mkpartfs, move, resize." –  May 06 '15 at 11:59