Expand Ubuntu Filesystem on Hyper-V not going through
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Model: Msft Virtual Disk (scsi) Disk /dev/sda: 65,5GB Sector size (logical/physical): 512B/4096B Partition Table: msdos Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 52,7GB 52,7GB primary ext4 boot
2 52,7GB 53,7GB 1022MB extended
5 52,7GB 53,7GB 1022MB logical linux-swap(v1)
**3 53,7GB 65,5GB 11,8GB primary ext4**
I followed some instructions in some articles here but was not successful. I tried the GUI but cant extend the volume. What is strange, in all articles, they mention that I need the name of the group of disks which is not the case Doing
Code:
fdisk -l
it shows
Code:
Disk /dev/sda: 61 GiB, 65498251264 bytes, 127926272 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x0ea54806
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 102856703 102854656 49G 83 Linux
/dev/sda2 102858750 104855551 1996802 975M 5 Extended
**/dev/sda3 104855552 127926271 23070720 11G 83 Linux**
/dev/sda5 102858752 104855551 1996800 975M 82 Linux swap / Solaris
Code:
Partition 2 does not start on physical sector boundary.
Partition table entries are not in disk order.
I tried growpart /dev/sda 1 I get
Quote:
NOCHANGE: partition 1 could only be grown by 2046 [fudge=2048]
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.