Moving a partition without gparted

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?

user118741

Posted 2015-05-06T09:35:14.677

Reputation:

Question was closed 2015-05-07T03:04:52.473

@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? – None – 2015-05-06T13:03:58.020

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 – 2015-05-06T13:29:21.547

Answers

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

Posted 2015-05-06T09:35:14.677

Reputation: 176

1

Thank you, that's a good suggestion, however, after reading the documentation for the current version 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."

– None – 2015-05-06T11:59:02.790