clearpart
The clearpart Kickstart command is optional. It removes partitions from the system, before creating new partitions. By default, no partitions are removed. Use this command only once.
- Syntax
-
clearpart OPTIONS - Options
-
--all- Erases all partitions from the system.This option will erase all disks which can be reached by the installation program, including any attached network storage. Use this option with caution.
You can prevent
clearpartfrom wiping storage you want to preserve by using the--drives=option and specifying only the drives to clear. You can also attach network storage later, for example in the%postsection of the Kickstart file. Another option is to blocklist the kernel modules used to access network storage.--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 --allTo 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 WWID58095BEC5510947BE8C0360F604351918, use:clearpart --drives=disk/by-id/scsi-58095BEC5510947BE8C0360F604351918This format is preferable for all multipath devices. If errors occur, multipath devices that do not use LVM can also use 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 WWID2416CD96995134CA5D787F00A5AA11017, use:clearpart --drives=disk/by-id/dm-uuid-mpath-2416CD96995134CA5D787F00A5AA11017Never specify multipath devices by device names like
mpatha. Device names such as this are not specific to a particular disk. The disk named/dev/mpathaduring installation might not be the one that you expect it to be. Therefore, theclearpartcommand could target the wrong disk.--initlabel- Initializes a disk (or disks) by creating a default disk label for all disks in their respective architecture that have been designated for formatting (for example, gpt for x86). Because--initlabelcan see all disks, it is important to ensure only those drives that are to be formatted are connected. Disks cleared byclearpartwill have the label created even in case the--initlabelis not used.clearpart --initlabel --drives=names_of_disksFor example:
clearpart --initlabel --drives=dasda,dasdb,dasdc--list=- Specifies which partitions to clear. This option overrides the--alland--linuxoptions if used. Can be used across different drives. For example:clearpart --list=sda2,sda3,sdb1--disklabel=LABEL- Set the default disklabel to use. Only disklabels supported for the platform will be accepted. For example, on the 64-bit Intel and AMD architectures, themsdosandgptdisklabels are accepted, butdasdis not accepted.--linux- Erases all Linux partitions.--none(default) - Do not remove any partitions.--cdl- Reformat any LDL DASDs to CDL format.
- Notes
-
- On the
x86_64systems running in Legacy BIOS mode, the GPT disklabel is the default. To ensure these systems can boot properly with GPT, add a dedicated BIOS boot partition. For automated installations, consider using thereqpartkickstart command to create this BIOS boot partition when required automatically. Optionally, use thepartkickstart command, for example:part biosboot --size=1. If you prefer to stick with the older MBR partitioning scheme instead of GPT, you have two options:- During a kickstart installation, use the
--disklabel msdosoption with theclearpartcommand. - Alternatively, add the
inst.disklabel=mbrboot option at the installer’s boot prompt.
- During a kickstart installation, use the
- To specify a multipath device, use the format
disk/by-id/scsi-WWID, where WWID is the world-wide identifier for the device. For example, to specify a disk with WWID58095BEC5510947BE8C0360F604351918, use:ignoredisk --only-use=disk/by-id/scsi-58095BEC5510947BE8C0360F604351918This format is preferable for all multipath devices. If errors occur, multipath devices that do not use LVM can also use the
disk/by-id/dm-uuid-mpath-WWIDformat, where WWID is the device world-wide identifier. For example, to specify a disk with WWID 2416CD96995134CA5D787F00A5AA11017, use:ignoredisk --only-use=disk/by-id/dm-uuid-mpath-2416CD96995134CA5D787F00A5AA11017Never 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
ignorediskcommand could target the wrong disk. - The
sdX(or/dev/sdX) format does not guarantee consistent device names across reboots, which can complicate the usage of some Kickstart commands. When a command requires a device node name, you can use any item from/dev/diskas an alternative. For example, instead of using the following device name:clearpart --drives=sdaYou can use an entry similar to one of the following:
clearpart --drives=/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0clearpart --drives=/dev/disk/by-id/ata-ST3160815AS_6RA0C882By using this approach, the command always targets the same storage device. This is especially useful in large storage environments. To explore the available device names on the system, you can use the
ls -lR /dev/diskcommand during the interactive installation. For more information about different ways to consistently refer to storage devices, see Persistent naming attributes. - If the
clearpartcommand is used, then thepart --onpartcommand cannot be used on a logical partition.
- On the