Guides to command line partition tools all warn that there is no undo. The classic tools write to the disk as soon as you commit, with no preview of the result and no way to resume if something stops them. Here is a short look at them, and at VisParted, which plans the change first.

The Classic Tools

On Linux, fdisk and gdisk edit partition tables and write everything when you press w. cfdisk does the same work from a menu. sfdisk saves a table to a file and restores it, which suits scripts. parted applies each command as soon as you type it. On Windows, diskpart manages disks from an administrator prompt (Microsoft’s reference lists its commands), and its clean command removes a drive’s partitions without asking.

All of them act at once. None of them shows the finished layout first, or picks up where an interruption left off.

VisParted in a Terminal

VisParted, the partition editor in Parted Magic, does the same work from a terminal, over SSH or a serial console as well. You describe the change you want, and VisParted makes a plan: a numbered list of steps, the risks in plain words, and the layout before and after. Nothing is written until you confirm, and a change that destroys data needs you to type yes. While the plan runs, a journal records its progress, so interrupted work can be resumed. When it finishes, VisParted reads the disk back and checks the result against the plan.

A plan can be saved, checked and applied later:

visparted plan /dev/sda --resize 2 --size min --out shrink.json
visparted simulate shrink.json
visparted apply shrink.json --journal /mnt/usb/journals --commit

The Text Interface

Type visparted tui for a text interface with the same screens as the window. The first screen lists the drives. Open one to see a bar of the disk drawn to scale and a row for each partition. One key starts each job: e resize, m move, c copy, n new, d delete, f format, k check, t partition table, and more. The ? key opens the full manual.

The Partition Manager page lists every command and key. VisParted comes with every copy of Parted Magic; see the store page.