Check Parted Version
parted -v, --version
parted --versionparted (GNU parted) 3.3Copyright (C) 2019 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.This is free software: you are free to change and redistribute it.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:
(parted) print
(parted) is the prompt of parted.
print short as p.
Model: VMware, VMware Virtual S (scsi)Disk /dev/sda: 53.7GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: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:
(parted) select /dev/sdX
Create Partition in Linux
We choose GPT partition table for our system.
Make partition
Running parted.
- make label for disk
mklabel gpt
- make root partition
(parted) mkpartPartition name? []? rootFile system type? [ext2]? ext4Start? 1End? 20480
- make swap partition
(parted) mkpartpartition name? []? swapFile system type? [ext2]? linux-swapStart? 20481End? 28673
parted -lModel: VMware, VMware Virtual S (scsi)Disk /dev/sda: 53.7GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 1049kB 20.5GB 20.5GB ext4 root2 20.5GB 28.7GB 8193MB linux-swap(v1) swap swap
Make File System
- make file system for root partition as ext4 format
mkfs.ext4 /dev/sda1
- make file system for swap partition as linux-swap format
mkswap /dev/sda2
Mount File System
- Mount root partition on
/mntdirectory:
mount /dev/sda1 /mnt
- Active swap partition
swapon /dev/sda2
