LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-22-2023, 10:29 AM   #1
eliassal
Member
 
Registered: Jan 2008
Posts: 100

Rep: Reputation: 0
Question 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]
 
Old 12-22-2023, 11:05 AM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,547

Rep: Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498
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.
 
Old 12-22-2023, 12:46 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,760

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
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.
 
Old 12-22-2023, 08:22 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,145

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
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.
 
Old 12-23-2023, 09:18 AM   #5
eliassal
Member
 
Registered: Jan 2008
Posts: 100

Original Poster
Rep: Reputation: 0
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
 
Old 12-23-2023, 11:16 AM   #6
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,149

Rep: Reputation: 393Reputation: 393Reputation: 393Reputation: 393
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.
 
Old 12-23-2023, 11:26 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,760

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
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/
 
  


Reply

Tags
disk management, fdisk, ubuntu



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Watch: How to Resize and Expand the Filesystem of Ubuntu MATE for Raspberry Pi 2 LXer Syndicated Linux News 0 12-14-2015 11:00 AM
expand filesystem atux_null Linux - Newbie 5 04-17-2015 06:32 AM
Expand ext3 filesystem past 13TB... hazoom Linux - Server 2 04-27-2011 04:07 PM
LXer: Ubuntu: Going from 256 MB to 512 MB means going from unusable to usable ... plu LXer Syndicated Linux News 1 03-07-2009 11:31 AM
add lvm to expand a full filesystem mariogarcia Linux - Software 3 04-27-2007 04:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration