Partitions
January 22, 2021 — 17:21

Author: silver  Category: linux windows  Comments: Off

Linux

Create new partition with parted:

# mbr
parted /dev/sda mklabel msdos
parted /dev/sda mkpart primary ext4 0% 100%

# gpt
parted /dev/sda mklabel gpt
parted /dev/sda mkpart part-label ext4 0% 100%

Note that ‘part-label’ cannot be empty, to remove: fdisk /dev/sda x n <enter> r w

To resize: parted /dev/sdX then resizepart X

Clone MBR partition table:

Use sfdisk:

sfdisk -d /dev/sda > partitions.txt
sfdisk /dev/sdb < partitions.txt

sfdisk -d /dev/sda | sfdisk /dev/sdb
sfdisk -d /dev/sda | sfdisk --force /dev/sdb

Clone GPT partition table:

  • use sgdisk
  • or gdisk

Windows

Partitioning tools:

  • diskpart (cli)
  • diskmgmt.msc
  • Minitool Partition Wizard (3rd party)
  • EaseUS Partition Master (3rd party)








We use Matomo free and open source web analytics (opt-out)