partitions

1. Check the Available Space

Before creating a new partition, let’s check how much space is available on the disk.

lsblk

You’ve already done this, but it’s important to note that the remaining space on nvme0n1 can be used for creating a new partition.

2. Create a New Partition

You can use fdisk to create a new partition:

  • Start fdisk on the disk nvme0n1:
fdisk /dev/nvme0n1
  • Create a New Partition:
    • Press n to create a new partition.
    • You will be prompted to select a partition number; choose the next available number (likely 4 in this case).
    • Accept the default start sector by pressing Enter.
    • Specify the size or just press Enter to use all available space.
  • Write the Changes:
    • After creating the partition, press w to write the changes to the disk and exit fdisk.

3. Install the parted Package:

apt-get install parted

4. Update the Kernel Partition Table

After creating the partition, run the following command to update the kernel’s partition table:

partprobe /dev/nvme0n1

5. Format the New Partition (Optional)

If you want to use the new partition for a specific purpose, like creating a new filesystem, you can format it:

mkfs.ext4 /dev/nvme0n1p4

Replace ext4 with another filesystem type if needed.

6. Extend an Existing LVM (Optional)

If you prefer to add the new partition to your existing LVM setup:

  1. Add the Partition to the Volume Group: pvcreate /dev/nvme0n1p4 vgextend pve /dev/nvme0n1p4
  2. Extend an Existing Logical Volume: If you want to extend the pve-data logical volume: lvextend -l +100%FREE /dev/pve/data
  3. Resize the Filesystem: After extending the logical volume, resize the filesystem to utilize the new space: resize2fs /dev/pve/data

7. Mount the New Partition (If Formatted)

If you created a new filesystem on the partition, you can mount it:

mkdir /mnt/new_partition
mount /dev/nvme0n1p4 /mnt/new_partition

Summary

  • Create a new partition using fdisk.
  • Format the partition if needed.
  • Add the partition to an LVM group or mount it directly.

These steps should allow you to fully utilize the unallocated space on your disk.