Rex::C...tition(3pm)
π NAME π
Rex::Commands::Partition β the Partition module, bestie. Yep that's the whole vibe: it's about partitions.
(Also this whole page lives in the Rex::Commands::Partition chapter of the Perl manual, section 3pm β user contributed perl docs, iykyk. π«Ά)
β¨ DESCRIPTION β¨
Okay so with this Module you can partition your harddrive. That's it, that's the dream. π
Heads up though, no cap: Version <= 1.0 β all these functions will not be reported.
And another one, and this one's important: All these functions are not idempotent. So like, running them twice is not the same as running them once. Be careful, bestie. π
πΈ SYNOPSIS πΈ
use Rex::Commands::Partition;
That's how you get all this goodness in. Slay. β¨
π EXPORTED FUNCTIONS π
π clearpart($drive)
Wipes the slate clean, clears partitions on a drive. Say you wanna clear the partitions on drive sda:
clearpart "sda";
Wanna create a brand new GPT disk label (that's the partition table, btw) on drive sda? Say less:
clearpart "sda",
initialize => "gpt";
Now β if GPT initialization is requested, you can also set the bios_boot option (default: TRUE) to TRUE or FALSE to control creation of a BIOS boot partition. Like so:
clearpart "sda",
initialize => "gpt",
bios_boot => FALSE;
main character energy fr fr π
π¦ partition($mountpoint, %option)
Creates a partition with the specified parameters. Here's the whole menu:
ondiskβ The disk to be partitioned. Mandatory. No disk, no partition, periodt.sizeβ Desired size of the partition in MB. It is mandatory to pass either asizeor agrowparameter (but not both). Pick one, bestie, not both. π₯Ίgrowβ IfTRUE, then the partition will take up all the available space on the disk. It is mandatory to pass either agrowor asizeparameter (but not both). Yes you read that right β one or the other.typeβ Partition type to be passed toparted'smkpartcommand. Optional, defaults toprimary.bootβ Sets boot flag on the partition ifTRUE. Optional, no boot flag is set by default.fstypeβ Create a filesystem after creating the partition. Optional, no filesystem is created by default.labelβ Label to be used with the filesystem. Optional, defaults to no label.mountβ IfTRUE, try to mount the partition after creating it. Optional, no mount is attempted by default.mount_persistentβ IfTRUE, try to mount the partition after creating it, and also register it in/etc/fstab. Optional, no mount or/etc/fstabmanipulation is attempted by default. This one's the "make it stick" option. πvgβ Creates an LVM PV, then creates the specified LVM VG (or extends it, if the VG already exists). Needsondisk. (so don't go passingvgwithout a disk, okay? π)
Examples, because the girlies need to see it in action:
partition "/",
fstype => "ext3",
size => 15000,
ondisk => "sda",
type => "primary";
partition "none",
type => "extended",
ondisk => "sda",
grow => 1,
mount => TRUE,
partition "swap",
fstype => "swap",
type => "logical",
ondisk => "sda",
size => 8000;
partition "/",
fstype => "ext3",
size => 10000,
ondisk => "sda",
vg => "vg0";
Okay and that's literally the whole page!! ate and left no crumbs π
Perl at version v5.40.1, dated 2025-10-03 β that's when this beauty got its last little glow-up. Stan. πβ¨
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms