Need a help trying to get a question I couldn't find anywhere, and most solutions were outdated. Is there a CLI-only solution to move partitions between the same disk?

"parted" used to have a function for that, but the feature was dropped at 2016 due unmaintainance.

For this case, assume the partition format and data is "unknown" (non standard partition or encrypted), also assume the partition is considerably big and not possible to just create a secondary partition and clone with dd if=/dev/sda1 of=/dev/sda2

For easy understanding of the problem, assume there is a /dev/sda1 at the middle of the disk using ~70% of space.


1 Answer 1


Self solution,

sfdisk tool has a "bad documented" way to move partitions, so let's say I need to move my partition 1 from disk /dev/sda to sector 2048, so the commands would be:

sfdisk /dev/sda -N 1

The previous command will tell sfdisk to use partition 1 from disk /dev/sda.

Then, just type the beginning of partition desired, using sector or byte format.

sda1: 2048

Typing 2048 will move partition 1 to sector 2048.

Hope this works for someone else! You can also use dd but under your own risk, this is a safer option.

Source: Debugging commands used by KDE Partition Manager when moving partitions, also used by myself when need it.

  • 1
    cfdisk or sfdisk? Commented Jul 19, 2022 at 7:37
  • 1
    sfdisk. Thanks starbeamrainbowlabs for your contribution.
    – WalterCool
    Commented Jan 20, 2023 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .