Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Trying to resize sda5 volume

  1. #11
    Join Date
    Jan 2020
    Beans
    9

    Re: Trying to resize sda5 volume

    thank you. I think this is what I was missing. If I use the live media, is 'cfdisk' available or do I need to use fdisk? If fdisk, do I delete the disk and simple recreate it at the same starting sector? Is this what everyone means by "expand".

  2. #12
    Join Date
    Jan 2020
    Beans
    9

    Re: Trying to resize sda5 volume

    Alright, so I booted into a Live CD and tried to do the following.
    1) fdisk /dev/sda
    2) p to list all partitions and document sectors
    3) d to delete sda2 and sda5
    4) n to create a new extended partition (sda2) with the same starting sector size listed in step 2 for sda2 (failed); invalid range. I chose extended because if I select 'primary' the file system type is Linux and not Extended.
    5) n to create a new primary partition (sda2) with the same starting sector as sda5; success
    6) N to not remove the existing signature
    7) boot and received a "error: no such partition. Entering rescue mode.
    8) restore VMGuest snapshot..

  3. #13
    Join Date
    Jan 2020
    Beans
    9

    Re: Trying to resize sda5 volume

    [duplicate post, delete me please ]

  4. #14
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,767

    Re: Trying to resize sda5 volume

    I didn't notice that this is a virtual disk before post #10. The suggestion about using the installer CD won't work. I had a case like this where expanding a virtual machine partition was done working from the VM. The problem was raised in this post. That disk had 21.5 G total, but my root partition 3 ended at 17.2 GB. I wanted to expand it to use the remaining disk space. A method was found using parted, and the bare outline of the steps is in the code block of post #14 of that same thread. However, the partitioning there was GPT. If this method works with an MS-DOS partitioned disk is untested, but I don't see why not.

    Edit: Tested, and this procedure works with an MS-DOS partitioned disk, resizing the extended-partition then the logical partition.
    Last edited by Dennis N; April 4th, 2024 at 05:15 PM.

  5. #15
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Trying to resize sda5 volume

    So, the "best" answer is not to use MS-DOS/MBR partitioning. Doing so, brings all the old limitations and workarounds that came with HDD partitioning since the 1980s. Only 4 primary partitions are allowed. 1 of those primary partitions can be an "extended" partition which can hold a bunch of "Logical Partitions", assuming every single logical partition fits inside the "extended partition". You can read up on each of these things in the wikipedia articles. Anyone over 30 that setup HDDs probably has all of this memorized. We had to live with it for decades.

    So, you decide not to use DOS/MBR partitioning. What should you use? GUID Partitioning - also called GPT. You can read up on it at wikipedia. It removes the needs for workarounds. It supports huge HDDs, it doesn't place the primary and backup partition table next to each other. One is at the start of the storage and the other is at the end. This should drastically reduce the chance that both copies of the GPT become corrupted - they aren't anywhere near each other. Additionally, GPT disks can have over 100 primary partitions, so the prior limit of 4 is gone. All partitions are primary in GPT.

    A little more history. fdisk and fdisk-based tools didn't support GPT for many years. If you use old versions from around 2010, they won't work. Other tools, based on "parted" were used and still exist. gparted is the GUI partitioning tool which is very capable and popular across all Linux systems. Both parted and gparted support both DOS and GPT partitioning. If you are working on a server that doesn't have any GUI, sometimes it is easier to do partitioning of the disk from a Try Ubuntu ISO environment BEFORE doing the install. Partitioning inside the Ubuntu Installers has always sucked.

    Sadly, disk partitions still cannot be modified while file systems inside are mounted regardless, so we still need to boot from alternate media to make changes. There are ways around this using volume management tools, but those are mainly for IT professionals due to the complexity and capabilities provided.

    In summary. Start over. Ensure that GPT is used. Then the legacy DOS/MBR partitioning workarounds won't happen. You'll be able to extend the VM storage and then extend the last partition inside that storage easily. Use gparted to get a nice visual image of the disk involved.

    Lastly, if you are using SSDs, remember that all storage locations are virtual and have nothing to do with the actual chips used to hold our data.

  6. #16
    Join Date
    Jun 2014
    Beans
    7,448

    Re: Trying to resize sda5 volume

    Your fdisk output from post 3 shows that you configured the virtual drive using only 50% of the available space. You can see that by checking total sectors and the sectors used for sda2 and sda5. Why did you not use all the space? If you don't have any data on it just do it over and use the entire disk.

    I chose extended because if I select 'primary' the file system type is Linux and not Extended.
    Why would you want an Extended partition? There is no point to it and the partition on which you actually install Ubuntu if you do this will be sda5 and a logical partition and will have a file system type of Linux which is what is needed. The suggestion to use a GPT disk label is recommended although it is possible to do an EFI install of Linux on a dos disk there really is no reason to do it and it is not recommended.

    Are you doing this just to learn about partitioning and resizing? If not, there is no reason to do anything more than recreate the virtual device.

  7. #17
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Trying to resize sda5 volume

    Quote Originally Posted by yancek View Post
    The suggestion to use a GPT disk label is recommended although it is possible to do an EFI install of Linux on a dos disk there really is no reason to do it and it is not recommended.
    Odd. I've been using GPT with BIOS booting for over a decade. It is only MSFT that arbitrarily made EFI + GPT required. Linux doesn't care and has supported every mix+match of GPT/MBR and UEFI/Legacy Boot. Around 2010, some non-standard hardware didn't like that, but it was a bug in the BIOS, not a Linux restriction.

    Basically, always use GPT with all disks on Linux regardless of boot method has worked since around 2014 hardware. Well ... maybe some really, really, cheap systems from HP or Acer didn't support this, but I've never had an issue.

  8. #18
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,767

    Re: Trying to resize sda5 volume

    Sadly, disk partitions still cannot be modified while file systems inside are mounted regardless, so we still need to boot from alternate media to make changes.
    A partition (including root) actually can be resized while in use if you follow the procedure outlined here.

  9. #19
    Join Date
    Jun 2014
    Beans
    7,448

    Re: Trying to resize sda5 volume

    Odd. I've been using GPT with BIOS booting for over a decade. It is only MSFT that arbitrarily made EFI + GPT required. Linux doesn't care and has supported every mix+match of GPT/MBR and UEFI/Legacy Boot. Around 2010, some non-standard hardware didn't like that, but it was a bug in the BIOS, not a Linux restriction.
    Obviously that can be done and I have an old release of Ubuntu installed in Legacy mode on an external drive flash drive that is gpt as well as an EFI install on a dos drive. It is generally 'suggested' or 'recommended' (particularly to new users) to do EFI on GPT.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •