Resize Linux VM Ext4 File System Proxmox
-
I've just completed this and didn't want to use Gparted. I've searched and couldn't find any guides on here so I've created the steps I took to extend an Ext4 partition without data loss. I extended the VM storage size in proxmox:
WARNING!!!!!! -Backup all data first! accidentally entering the wrong commands could loose all your data on the partition, extreme caution should be used when extending partitions.
You should also note to check your not using LVM file system. You can check by typing df -h -T – this will show if it’s a EXT4 or LVM partition.
- First shutdown VM
- extend VM storage by the amount you need
- Boot from latest Ubuntu CD (present time 20.04LTS)
- don’t go through installer, select help from top right corner
Select enter shell option, you will now enter a bash shell - get a list off filesystems by typing df -h -T – you should see something like root “/” type ext4
- you can type in fdisk -l to display attached drives.
- my drive is called sda – so type in fdisk /dev/sda
- press p to display partitions
- I have Sda1 and sda2 – sda1 is my boot partition
- You will also see start and end sectors, make a note in case of problems
- enter d to delete partition, so select 2 (we don’t want to delete our boot partition)
- enter p and you will now see the partition is deleted.
- press n to create partition it will say (default 2) just press enter
- it will display first sector with default of your previous partition – just press Enter (don’t change)
- It will then display last sector, once again just press Enter (don’t change)
- it will ask partition #2 contains an ext4 – just say NO to removing signature.
- enter w to write the partition data.
- once you are out of fdisk if you type df -h you will notice size hasn’t extended.
- we have to manually extend the file system with command resize2fs /dev/sda2
you will now see the extended space added in root “/” by typing df -h
-
I see few issues above.
- LVM is not a filesystem.
- You don't need to shutdown VM to extend its disk size.
- You don't need to boot from any installer CD to resize partitions, you can do it from within live system with fdisk, although if you have some unusual partition layout you're probably better off doing it offline.
- You can also extend filesystem on a live system, no need for shutdown.
-
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
I see few issues above.
- LVM is not a filesystem.
- You don't need to shutdown VM to extend its disk size.
- You don't need to boot from any installer CD to resize partitions, you can do it from within live system with fdisk, although if you have some unusual partition layout you're probably better off doing it offline.
- You can also extend filesystem on a live system, no need for shutdown.
I thought his approach was over cautious. Windows will allow you to extend any partition except the drive live, and I'm guessing you can likely extend even / live in Linux OSes.
-
@dashrender said in Resize Linux VM Ext4 File System Proxmox:
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
I see few issues above.
- LVM is not a filesystem.
- You don't need to shutdown VM to extend its disk size.
- You don't need to boot from any installer CD to resize partitions, you can do it from within live system with fdisk, although if you have some unusual partition layout you're probably better off doing it offline.
- You can also extend filesystem on a live system, no need for shutdown.
I thought his approach was over cautious. Windows will allow you to extend any partition except the drive live, and I'm guessing you can likely extend even / live in Linux OSes.
Are you sure about extending c:? I've done it many times, on live systems. Although it was on bare metal desktops after cloning drive to a bigger one.
-
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
@dashrender said in Resize Linux VM Ext4 File System Proxmox:
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
I see few issues above.
- LVM is not a filesystem.
- You don't need to shutdown VM to extend its disk size.
- You don't need to boot from any installer CD to resize partitions, you can do it from within live system with fdisk, although if you have some unusual partition layout you're probably better off doing it offline.
- You can also extend filesystem on a live system, no need for shutdown.
I thought his approach was over cautious. Windows will allow you to extend any partition except the drive live, and I'm guessing you can likely extend even / live in Linux OSes.
Are you sure about extending c:? I've done it many times, on live systems. Although it was on bare metal desktops after cloning drive to a bigger one.
You did it live with windows tools? OK that would be a new one on me.
-
@dashrender said in Resize Linux VM Ext4 File System Proxmox:
I thought his approach was over cautious. Windows will allow you to extend any partition except the drive live, and I'm guessing you can likely extend even / live in Linux OSes.
Did a C:\ drive on a SQL server VM month or two ago.
-
@dashrender said in Resize Linux VM Ext4 File System Proxmox:
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
@dashrender said in Resize Linux VM Ext4 File System Proxmox:
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
I see few issues above.
- LVM is not a filesystem.
- You don't need to shutdown VM to extend its disk size.
- You don't need to boot from any installer CD to resize partitions, you can do it from within live system with fdisk, although if you have some unusual partition layout you're probably better off doing it offline.
- You can also extend filesystem on a live system, no need for shutdown.
I thought his approach was over cautious. Windows will allow you to extend any partition except the drive live, and I'm guessing you can likely extend even / live in Linux OSes.
Are you sure about extending c:? I've done it many times, on live systems. Although it was on bare metal desktops after cloning drive to a bigger one.
You did it live with windows tools? OK that would be a new one on me.
I've done it lots of times on C for physical and virtual using built in tools. That's not a new one.
-
@dashrender said in Resize Linux VM Ext4 File System Proxmox:
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
@dashrender said in Resize Linux VM Ext4 File System Proxmox:
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
I see few issues above.
- LVM is not a filesystem.
- You don't need to shutdown VM to extend its disk size.
- You don't need to boot from any installer CD to resize partitions, you can do it from within live system with fdisk, although if you have some unusual partition layout you're probably better off doing it offline.
- You can also extend filesystem on a live system, no need for shutdown.
I thought his approach was over cautious. Windows will allow you to extend any partition except the drive live, and I'm guessing you can likely extend even / live in Linux OSes.
Are you sure about extending c:? I've done it many times, on live systems. Although it was on bare metal desktops after cloning drive to a bigger one.
You did it live with windows tools? OK that would be a new one on me.
Also did it live on Linux as well in both cases.
-
@marcinozga said in Resize Linux VM Ext4 File System Proxmox:
I see few issues above.
- LVM is not a filesystem.
- You don't need to shutdown VM to extend its disk size.
- You don't need to boot from any installer CD to resize partitions, you can do it from within live system with fdisk, although if you have some unusual partition layout you're probably better off doing it offline.
- You can also extend filesystem on a live system, no need for shutdown.
- correct, didn't think properly when I wrote that. Logical volumes can be put into logical groups that could contain pools of hdd's that can be sees as one, can also move space around easier and have snapshots.
- I had errors when trying to write the new partition layout hence why I used a live CD. Probably could of looked into it more but didn't want to spend forever on it or mess up any partition data.