Expand Ubuntu Filesystem on Hyper-V not going through
can you please help in letting me know the steps needed to increase the size of ubuntu hard drive. It is VM, I increased the disk in hyper-V by 11G. Inside the VM, when I run PARTED Print I see
Code:
~# parted GNU Parted 3.4 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Code:
fdisk -l Code:
Disk /dev/sda: 61 GiB, 65498251264 bytes, 127926272 sectors Code:
Partition 2 does not start on physical sector boundary. Quote:
|
If you look at your fdisk output and subtract the end sector of sda1 from the start sector of sda2, you get the result shown at the bottom of your post. sda3 is another primary partition but it is not contiguous to sda1 so you cannot expand it but can use it as a separate data partition. You are using a dos partition table which has an Extended partition and a swap within it. Maybe reinstall and use gpt.
You could delete the swap and then the Extended partition and move sda3 to the left. If you haven't done this type thing very much you should just reinstall and prepare the partitions the way you want. |
I assume you created /dev/sda3 with added space since it is 11GB. If so delete /dev/sda3, turn off swap and delete /dev/sda5 and /dev/sda2. It is possible using parted and resize2fs to expand /dev/sda1 while active but make sure you do have anything important backed up just in case. Create a new swap partition, format, update /etc/fstab with its new UUID and turn it back on. You do not need to recreate an extended partition.
|
And if you are planning on doing this again, you don't need the swap partition - it will just get in the way again. After the increase in size, simply allocate a swap file and add that to fstab. Will make life easier in future.
|
Thanks to yancek michaelk and syg00
As this is thest time I do thiis, can you please help on - If so delete /dev/sda3 HOW? - turn off swap : swap is already off as it was one of the prerequisites to install Kubernetes - delete /dev/sda5 and /dev/sda2, again HOW? If possible please share the instructions in the form of commandline arguments so I dont do any mistake Yes I have a backup of the VM |
If I may you should rebuild the virtual machine using LVM instead of fixed partitions. Makes life a ton easier if you ever have any inkling you will be changing or wanting to change partition structures. Well worth the small time investment to change it over.
|
To delete partitions you can use any partitioning utility i.e. fdisk, parted etc.
https://www.gnu.org/software/parted/manual/parted.html https://www.tecmint.com/fdisk-comman...sk-partitions/ |
All times are GMT -5. The time now is 04:36 PM. |