parted
is a Lynux program that partitions disks.
parted
works on MBR
and GPT
partitions.
Type man parted
in a command window to see all the options for parted
.
Open a superuser command window to call parted
.
parted
can be used interactively or can be called from scripts. The following can be issued in interactive mode, after typing parted
in a command window.
select /dev/sdb
msdos
or gpt
.
There is always a default disk. Be sure to select the disk you want, or you might edit the boot disk by mistake.
Help for any command can be listed with m
View a video on partitioning with parted.
Create a script file with parted
commands. Each command must specify the disk to use.
parted /dev/sdc mkpart primary 1MiB 3.99MiB parted /dev/sdc unit MiB print
Run the script from a superuser command window:
./myParted.sh
The output of the command will look something like
Information: You may need to update /etc/fstab. Model: ATA VBOX HARDDISK (scsi) Disk /dev/sdc: 20.0MiB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1.00MiB 3.99MiB 2.99MiB primary
Redirect the output of the script to a text file with
./myParted.sh > myParted.out.txt