How it works...
Before we can use LVM safely, we should create at least one partition on the raw device. For this, we use parted, a more advanced partition editor than fdisk. We need parted because it can set the partition table type as GPT, which allows filesystems greater than 2 TB. This is what the first invocation of parted does, with the mklabel parameter set to gpt.
To create the partition itself, we call parted with the mkpart parameter. By using mkpart, we also need to specify the type of partition we want, and its starting and ending positions. We keep things simple by starting at the beginning of the device and using 100% of the available storage.
Finally, we set the LVM flag to true by invoking parted with the set parameter. The ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access