Product SiteDocumentation Site

A.2.4. clearpart (optional) - Remove All Existing Partitions

Removes partitions from the system, prior to creation of new partitions. By default, no partitions are removed.

Note

If the clearpart command is used, then the part --onpart command cannot be used on a logical partition.
For a detailed example of partitioning including the clearpart command, see Section A.15.1, “Advanced Partitioning Example”.
--all
Erases all partitions from the system.

Warning

This option will erase all disks which can be reached by the installer, including any attached network storage. Use this option with caution.
--drives=
Specifies which drives to clear partitions from. For example, the following clears all the partitions on the first two drives on the primary IDE controller:
clearpart --drives=hda,hdb --all
To clear a multipath device, use the format disk/by-id/scsi-WWID, where WWID is the world-wide identifier for the device. For example, to clear a disk with WWID 58095BEC5510947BE8C0360F604351918, use:
clearpart --drives=disk/by-id/scsi-58095BEC5510947BE8C0360F604351918
This format is preferable for all multipath devices, but if errors arise, multipath devices that do not use logical volume management (LVM) can also be cleared using the format disk/by-id/dm-uuid-mpath-WWID, where WWID is the world-wide identifier for the device. For example, to clear a disk with WWID 2416CD96995134CA5D787F00A5AA11017, use:
clearpart --drives=disk/by-id/dm-uuid-mpath-2416CD96995134CA5D787F00A5AA11017

Warning

Never specify multipath devices by device names like mpatha. Device names such as this are not specific to a particular disk. The disk named /dev/mpatha during installation might not be the one that you expect it to be. Therefore, the clearpart command could target the wrong disk.
--list=
Specifies which partitions to clear. This option overrides the --all and --linux options if used. Can be used across different drives. For example:
clearpart --list=sda2,sda3,sdb1
--disklabel=
Create a set disk label when relabeling a disk.
--linux
Erases all Linux partitions.
--none
Do not remove any partitions. This is the default behavior - using this option is the same as not using the clearpart command at all.

Note

Using the clearpart --all command in a Kickstart file to remove all existing partitions during the installation will cause Anaconda to pause and prompt you for a confirmation. If you need to perform the installation automatically with no interaction, add the zerombr command to your Kickstart file.