13.3. Removing a Partition
Warning
Do not attempt to remove a partition on a device that is in use.
Procedure 13.3. Remove a Partition
- Before removing a partition, do one of the following:
- Boot into rescue mode, or
- Unmount any partitions on the device and turn off any swap space on the device.
- Start the
partedutility:parted device
# parted deviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace device with the device on which to remove the partition: for example,/dev/sda. - View the current partition table to determine the minor number of the partition to remove:
(parted) print
(parted) printCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove the partition with the command
rm. For example, to remove the partition with minor number 3:(parted) rm 3
(parted) rm 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow The changes start taking place as soon as you press Enter, so review the command before committing to it. - After removing the partition, use the
printcommand to confirm that it is removed from the partition table:(parted) print
(parted) printCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Exit from the
partedshell:(parted) quit
(parted) quitCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Examine the content of the
/proc/partitionsfile to make sure the kernel knows the partition is removed:cat /proc/partitions
# cat /proc/partitionsCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove the partition from the
/etc/fstabfile. Find the line that declares the removed partition, and remove it from the file. - Regenerate mount units so that your system registers the new
/etc/fstabconfiguration:systemctl daemon-reload
# systemctl daemon-reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow