If you want to add unallocated space to an existing partition such as /dev/nvme1n1p2, you can do so using a partitioning tool like GParted or fdisk. However, partitioning operations can be risky and may lead to data loss if not done carefully. It's strongly recommended to back up your data before proceeding.
Here's a step-by-step process using GParted, which provides a graphical interface and can be easier to manage:
Using GParted (Graphical Method)
-
Install GParted:
If it's not already installed, you can install it using:
sudo apt update
sudo apt install gparted
-
Run GParted:
You may need superuser privileges, so start GParted with:
sudo gparted
-
Select the Correct Drive:
Ensure you have the right drive selected (/dev/nvme1n1). You can change the drive from the device dropdown list at the top-right corner.
-
Locate and Resize the Partition:
- Find your partition
/dev/nvme1n1p2.
- If necessary, you might need to first move any adjacent partitions to ensure free space is contiguous.
- Right-click on
/dev/nvme1n1p2 and choose “Resize/Move”.
- Adjust the size to include the unallocated space.
- Click “Resize/Move”, then click the green checkmark button to apply changes.
-
Apply Changes:
Once all changes are correctly set up, click the “Apply” button to commit to the operations.
-
Verify:
After changes are made, verify the partition table with:
sudo fdisk -l /dev/nvme1n1
Using Command Line Tools
If you prefer to use command-line tools like fdisk or parted, the process will involve potentially deleting and recreating the partition, which can be riskier and should only be done if you are comfortable and data is backed up.
Using parted:
-
Start parted:
sudo parted /dev/nvme1n1
-
View the Partition Table:
(parted) print
-
Resize Partition:
- Determine the start point of
/dev/nvme1n1p2 and ensure it's contiguous with the free space.
- Use the
resizepart command with the appropriate partition number.
(parted) resizepart NUMBER END
Replace NUMBER with the partition number (e.g., 2 for /dev/nvme1n1p2) and END with the end position (e.g., 100% to use all available space).
-
Exit:
(parted) quit
Maintaining backup and understanding the risk of resizing partitions, especially with existing data, is crucial. Always double-check your actions and be prepared to restore data if necessary.