Results 1 to 3 of 3

Thread: Ubuntu Server VM: formatting of sda2 partition (mkfs.ext4 -G 4096) before install

  1. #1
    Join Date
    May 2020
    Beans
    3

    Ubuntu Server VM: formatting of sda2 partition (mkfs.ext4 -G 4096) before install

    Hi,

    I'm venturing into the fascinating world of Ubuntu and would like to install Ubuntu Server 20.04 LTS as a virtual machine in Hyper-V.

    Microsoft recommends that, when creating the file system on which Ubuntu will be installed, the number of block groups that will be packed together to create a larger virtual block group (or "flex_bg group") in an ext4 filesystem should be set to 4096 (mkfs.ext4 -G 4096 /dev/sdX1)

    When installing the Ubuntu Server VM, I didn't see an option to set this parameter.

    After having installed Ubuntu Server with the default options, I have the following partitions:

    Code:
    Model: Msft Virtual Disk (scsi)
    Disk /dev/sda: 42.9GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:
    
    Number  Start   End     Size    File system  Name  Flags
     1      1049kB  538MB   537MB   fat32              boot, esp
     2      538MB   42.9GB  42.4GB  ext4
    When running
    Code:
    dumpe2fs -h /dev/sda2
    I see that the number of block groups for sda2 is 16:

    Code:
    Flex block group size:    16
    Is there a way to set this to 4096 during install?

    If not, could I repartition sda2 with the correct number of block groups (with which tool (e.g. mounted in a (virtual) DVD drive?)) and then reinstall selecting manually the sda1 and sda2 partitions?
    Last edited by antoon-g; May 3rd, 2020 at 11:50 AM. Reason: Improved title

  2. #2
    Join Date
    May 2020
    Beans
    3

    Re: Ubuntu Server VM: formatting of sda2 partition (mkfs.ext4 -G 4096) before install

    Would the following work:


    1. mount an Ubuntu LiveCD in a virtual DVD drive and choose 'Try Ubuntu without any change to your computer'
    2. format the sda2 partition with the following command
      Code:
      mkfs.ext4 -G 4096 /dev/sda2
      Will the Ubuntu instance launched from the LiveCD see this partition?; Should I also wipe the sda1 partition with
      Code:
      mkfs.vfat -F 32 /dev/sda1
    3. reinstall Ubuntu Server and manually select the (reformatted?) sda1 partition and the (reformatted) sda2 partition


    Is there a way to make the Ubuntu Server installer use these partitions as-is without reformatting ?

  3. #3
    Join Date
    May 2020
    Beans
    3

    Re: Ubuntu Server VM: formatting of sda2 partition (mkfs.ext4 -G 4096) before install

    I figured it out and wrote a How-to here.

    @Canonical: could you please consider adding an option in the Filesystem Setup menu to set the 'Flex block group size' (perhaps with a dropdown menu offering choices of the power of 2 ?) of the filesystem partition?
    Last edited by antoon-g; May 4th, 2020 at 04:09 PM.

Tags for this Thread

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
  •