Ubuntu 20.04: How to Extend Partition (For Noobs)
-
how do you make code blocks have a darker background/box around them?
-
@humptydumpty said in Ubuntu 20.04: How to Extend Partition (For Noobs):
how do you make code blocks have a darker background/box around them?
by using the super secret markdown code tag
-
@humptydumpty This is a really good guide for those that need to expand when they run out of space, as a side note (but not to over explain cause this is a different topic??) LVM can be a easier in the long run and supports features like full-disk encryption.
If your VPS provider or home server supports it, extending an LVM disk is as simple as just adding another disk (or partition) to the group:
- Create (init) the new disk:
pvcreate /dev/sdX
- Extend the LVM:
vgextend LVM_VG_NAME /dev/sdX
(Find the LVM_VG_NAME withvgs
command) - Extend the LV virtual device:
lvextend -l +100%FREE /dev/VM_VG_NAME/root
(Can be found withlvs
- Resize new free space with fs of choice, resize2fs is usually used here:
resize2fs /dev/VM_VG_NAME/root
If you have the option to use LVM in the future, you should use it, allows you to just expand or add disks to a virtual (aka logical) volume for storage. Kind of like RAID.
- Create (init) the new disk:
-
@necrevistonnezr I did click on that and typed the code inside the tags but it doesn't change the look of it.
-
@murgero having issues with step 1 - sdX (not found).. which translates to sdX according to this screenshot?
fdisk -l output:
vgs output: ubuntu-vg
lvs output: ubuntu-lvI tried "pvcreate /dev/nvme0n1p3" and it said it needed -ff .... added that at the end and it said "can't open, mounted filesystem?"
Suggestions?
-
@humptydumpty
/dev/sdX
where X is the drive letter (like sda. sdb, etc etc)However it looks like you have loop devices and nvme drives, in that case you will need to find what hasn't been added to the lvm and add it. Without seeing what you have, I can't say for sure what to add.
-
@murgero It's just a single M.2 NVME SSD but the Ubuntu server/Cloudron is only showing 100 out of 500GB. The rest is free space. Just to confirm I'm on the right path, I need to allocate the free space to the root partition, right?
BTW, why would Ubuntu only grab 100GB instead of all the available space on a fresh install? Did I mess up a setting somewhere?
-
LVM resize solved
Source: https://packetpushers.net/ubuntu-extend-your-default-lvm-space/
I didn't have to follow all that's in there so to keep it short, use these commands.
Run this first:
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
Now, run this second command:
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
Done! Refresh your Cloudron dashboard and check stats page. No reboot needed.
BTW, this diagram is great at showing how LVM works:
-
@humptydumpty during the install you have the option to change how much ubuntu uses - if you left it alone it would have used the default amount.
If this is a VPS provider, they likely did it wrong as well.
-
-
-