Parted command on Linux (partitioning disk)
The parted command in Linux was developed to partition and resize disk partitions. It allows you to create, destroy, resize, move, and copy ext2, Linux-swap, FAT, FAT32, ReiserFS, and HFS partitions. It is very useful for reorganizing disk usage as well as copying data to new disks.
Its use is for more experienced users, since it can create partitions directly at the prompt of shell.
If no command is entered as a parameter, parted will show its own command prompt.
The commands can be:
mklabel label-type
Creates a new partition table, which may be of the type “aix”, “amica”, “bsd”, “dvh”, “gpt”, “loop”, “mac”, “msdos”, “pc98”, or “sun”.
mkpart part-type [fs-type] start end
Creates a partition.
The part-type can be “primary”, “logical”, or “extended”.
The fs-type specifies the type of file system, which may or may not be entered. Accepted system types are: “btrfs”, “ext2”, “ext3”, “ext4”, “fat16”, “fat32”, “hfs”, “hfs”, “hfs+”, “linux-swap”, “ntfs”, “reiserfs” and “xfs”.
The start parameter defines the start of the partition. It’s an integer followed by a unit.
The end parameter defines the end of the partition. It’s an integer followed by a unit.
The drive may be the letter “s” for Sector, if the number entered is a sector on the disk, or “B” to indicate the start and end of the partition in Bytes. It is also possible to define the start and end of partitions on binary drives such as “MiB”, “GiB” and “TiB”.
name name
This command allows you to give a name to the partition. It can only be used on Mac, PC98, and GPT type partition tables.
Shows information about a partition.
To create a GPT partition table on the /dev/xvdb disk:
Yes Once the partition table has been created, the partition can be created:
Parted also allows you to view the newly created partition with the print command:
1 1049kB 8589MB 8588MB primary Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it?
Share