Check Parted Version

  1. parted -v, --version
  1. parted --version
  2. parted (GNU parted) 3.3
  3. Copyright (C) 2019 Free Software Foundation, Inc.
  4. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
  5. This is free software: you are free to change and redistribute it.
  6. There is NO WARRANTY, to the extent permitted by law.

List Linux Disk Partitions

Let parted to run.

Use this command to see the disk partitions:

  1. (parted) print

(parted) is the prompt of parted.

print short as p.

  1. Model: VMware, VMware Virtual S (scsi)
  2. Disk /dev/sda: 53.7GB
  3. Sector size (logical/physical): 512B/512B
  4. Partition Table: gpt
  5. Disk Flags:
  6. Number Start End Size File system Name Flags

List or Switch to Different Disk

If you have more than one disk, you can switch between disks.

Using select:

  1. (parted) select /dev/sdX

Create Partition in Linux

We choose GPT partition table for our system.

Make partition

Running parted.

  • make label for disk
    1. mklabel gpt
  • make root partition
    1. (parted) mkpart
    2. Partition name? []? root
    3. File system type? [ext2]? ext4
    4. Start? 1
    5. End? 20480
  • make swap partition
    1. (parted) mkpart
    2. partition name? []? swap
    3. File system type? [ext2]? linux-swap
    4. Start? 20481
    5. End? 28673
  1. parted -l
  2. Model: VMware, VMware Virtual S (scsi)
  3. Disk /dev/sda: 53.7GB
  4. Sector size (logical/physical): 512B/512B
  5. Partition Table: gpt
  6. Disk Flags:
  7. Number Start End Size File system Name Flags
  8. 1 1049kB 20.5GB 20.5GB ext4 root
  9. 2 20.5GB 28.7GB 8193MB linux-swap(v1) swap swap

Make File System

  • make file system for root partition as ext4 format
    1. mkfs.ext4 /dev/sda1
  • make file system for swap partition as linux-swap format
    1. mkswap /dev/sda2

Mount File System

  • Mount root partition on /mnt directory:
  1. mount /dev/sda1 /mnt
  • Active swap partition
  1. swapon /dev/sda2