VirtualBox - Dynamic virtual disk won't expand

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I'm working on a 64-bit CentOS 7 VM on my Windows 10 host, and I have a dynamically-allocated VHD that is giving me problems.



At first, the VHD's maximum size was set to 16GB, functionally about 14.4 usable. While working on a project I realized that I would need much more space, so I used VBoxManage to increase the maximum to 100GB. Then I used GParted to expand the sda2 partition so that it took up the extra space.



So VirtualBox recognizes that the VHD can go up to 100GB and sda2 takes up most of that space. The actual size of the VHD right now is still 14.4GB. However when I fill up all of this space on the guest OS (by writing a long seq into a file), the drive not does automatically expand.



A couple of things to note:



  1. The first time I tried to fill up the space, when I restarted the VM after filling it up, the VHD file on my host did increase by about 1GB, however it won't expand any more now.


  2. There seems to be a discrepancy between the devices my guest OS reports and what partitions GParted reports. CentOS lists /dev/sda1 and /dev/mapper/centos-root, which is a link to /dev/dm-0, while GParted lists /dev/sda1 and /dev/sda2. Could this be causing the issue, or is this normal? If it is normal, any ideas as to why VirtualBox won't expand the VHD?







share|improve this question
















  • 2




    Did you "resize2fs"?
    – slass100
    Dec 6 '17 at 19:31










  • @slass100 I just tried using resize2fs, and I got this: resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root Couldn't find valid filesystem superblock.
    – Connor Howington
    Dec 6 '17 at 19:51










  • If you are using lvm/xfs, then 'xfs_growfs'. resizefs is for ext2/3/4
    – slass100
    Dec 6 '17 at 20:04










  • Yep, I figured that out and tried it, however it just says that /dev/mapper/centos-root is already at its maximum size.
    – Connor Howington
    Dec 6 '17 at 20:24














up vote
1
down vote

favorite












I'm working on a 64-bit CentOS 7 VM on my Windows 10 host, and I have a dynamically-allocated VHD that is giving me problems.



At first, the VHD's maximum size was set to 16GB, functionally about 14.4 usable. While working on a project I realized that I would need much more space, so I used VBoxManage to increase the maximum to 100GB. Then I used GParted to expand the sda2 partition so that it took up the extra space.



So VirtualBox recognizes that the VHD can go up to 100GB and sda2 takes up most of that space. The actual size of the VHD right now is still 14.4GB. However when I fill up all of this space on the guest OS (by writing a long seq into a file), the drive not does automatically expand.



A couple of things to note:



  1. The first time I tried to fill up the space, when I restarted the VM after filling it up, the VHD file on my host did increase by about 1GB, however it won't expand any more now.


  2. There seems to be a discrepancy between the devices my guest OS reports and what partitions GParted reports. CentOS lists /dev/sda1 and /dev/mapper/centos-root, which is a link to /dev/dm-0, while GParted lists /dev/sda1 and /dev/sda2. Could this be causing the issue, or is this normal? If it is normal, any ideas as to why VirtualBox won't expand the VHD?







share|improve this question
















  • 2




    Did you "resize2fs"?
    – slass100
    Dec 6 '17 at 19:31










  • @slass100 I just tried using resize2fs, and I got this: resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root Couldn't find valid filesystem superblock.
    – Connor Howington
    Dec 6 '17 at 19:51










  • If you are using lvm/xfs, then 'xfs_growfs'. resizefs is for ext2/3/4
    – slass100
    Dec 6 '17 at 20:04










  • Yep, I figured that out and tried it, however it just says that /dev/mapper/centos-root is already at its maximum size.
    – Connor Howington
    Dec 6 '17 at 20:24












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm working on a 64-bit CentOS 7 VM on my Windows 10 host, and I have a dynamically-allocated VHD that is giving me problems.



At first, the VHD's maximum size was set to 16GB, functionally about 14.4 usable. While working on a project I realized that I would need much more space, so I used VBoxManage to increase the maximum to 100GB. Then I used GParted to expand the sda2 partition so that it took up the extra space.



So VirtualBox recognizes that the VHD can go up to 100GB and sda2 takes up most of that space. The actual size of the VHD right now is still 14.4GB. However when I fill up all of this space on the guest OS (by writing a long seq into a file), the drive not does automatically expand.



A couple of things to note:



  1. The first time I tried to fill up the space, when I restarted the VM after filling it up, the VHD file on my host did increase by about 1GB, however it won't expand any more now.


  2. There seems to be a discrepancy between the devices my guest OS reports and what partitions GParted reports. CentOS lists /dev/sda1 and /dev/mapper/centos-root, which is a link to /dev/dm-0, while GParted lists /dev/sda1 and /dev/sda2. Could this be causing the issue, or is this normal? If it is normal, any ideas as to why VirtualBox won't expand the VHD?







share|improve this question












I'm working on a 64-bit CentOS 7 VM on my Windows 10 host, and I have a dynamically-allocated VHD that is giving me problems.



At first, the VHD's maximum size was set to 16GB, functionally about 14.4 usable. While working on a project I realized that I would need much more space, so I used VBoxManage to increase the maximum to 100GB. Then I used GParted to expand the sda2 partition so that it took up the extra space.



So VirtualBox recognizes that the VHD can go up to 100GB and sda2 takes up most of that space. The actual size of the VHD right now is still 14.4GB. However when I fill up all of this space on the guest OS (by writing a long seq into a file), the drive not does automatically expand.



A couple of things to note:



  1. The first time I tried to fill up the space, when I restarted the VM after filling it up, the VHD file on my host did increase by about 1GB, however it won't expand any more now.


  2. There seems to be a discrepancy between the devices my guest OS reports and what partitions GParted reports. CentOS lists /dev/sda1 and /dev/mapper/centos-root, which is a link to /dev/dm-0, while GParted lists /dev/sda1 and /dev/sda2. Could this be causing the issue, or is this normal? If it is normal, any ideas as to why VirtualBox won't expand the VHD?









share|improve this question











share|improve this question




share|improve this question










asked Dec 6 '17 at 19:05









Connor Howington

165




165







  • 2




    Did you "resize2fs"?
    – slass100
    Dec 6 '17 at 19:31










  • @slass100 I just tried using resize2fs, and I got this: resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root Couldn't find valid filesystem superblock.
    – Connor Howington
    Dec 6 '17 at 19:51










  • If you are using lvm/xfs, then 'xfs_growfs'. resizefs is for ext2/3/4
    – slass100
    Dec 6 '17 at 20:04










  • Yep, I figured that out and tried it, however it just says that /dev/mapper/centos-root is already at its maximum size.
    – Connor Howington
    Dec 6 '17 at 20:24












  • 2




    Did you "resize2fs"?
    – slass100
    Dec 6 '17 at 19:31










  • @slass100 I just tried using resize2fs, and I got this: resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root Couldn't find valid filesystem superblock.
    – Connor Howington
    Dec 6 '17 at 19:51










  • If you are using lvm/xfs, then 'xfs_growfs'. resizefs is for ext2/3/4
    – slass100
    Dec 6 '17 at 20:04










  • Yep, I figured that out and tried it, however it just says that /dev/mapper/centos-root is already at its maximum size.
    – Connor Howington
    Dec 6 '17 at 20:24







2




2




Did you "resize2fs"?
– slass100
Dec 6 '17 at 19:31




Did you "resize2fs"?
– slass100
Dec 6 '17 at 19:31












@slass100 I just tried using resize2fs, and I got this: resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root Couldn't find valid filesystem superblock.
– Connor Howington
Dec 6 '17 at 19:51




@slass100 I just tried using resize2fs, and I got this: resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root Couldn't find valid filesystem superblock.
– Connor Howington
Dec 6 '17 at 19:51












If you are using lvm/xfs, then 'xfs_growfs'. resizefs is for ext2/3/4
– slass100
Dec 6 '17 at 20:04




If you are using lvm/xfs, then 'xfs_growfs'. resizefs is for ext2/3/4
– slass100
Dec 6 '17 at 20:04












Yep, I figured that out and tried it, however it just says that /dev/mapper/centos-root is already at its maximum size.
– Connor Howington
Dec 6 '17 at 20:24




Yep, I figured that out and tried it, however it just says that /dev/mapper/centos-root is already at its maximum size.
– Connor Howington
Dec 6 '17 at 20:24










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Ok, I found what the problem was. My filesystem uses Logical Volume Management (LVM), which I have never worked with before, and so I didn't know how to properly handle it. Using LVM terminology, centos is a volume group:



centos



sda2 is a physical volume in that volume group:



sda2



and root is a logical volume in that volume group, along with swap:



root



The centos VG and the sda2 PV had already registered the extra storage I'd allocated, but all that was left was to allocate that extra space to the root LV (21504 is the number of free physical extents (PEs) that I got from vgdisplay):



$ sudo lvextend /dev/centos/root /dev/sda2 -l+21504



and then expand the root filesystem so that it could make use of this extra space:



$ sudo xfs_growfs /dev/centos/root



After this the guest OS recognized that it had extra space, and filling up this space causing a corresponding growth in the size of the virtual hard disk on the host OS. Success!



Source:
http://www.techotopia.com/index.php/Adding_a_New_Disk_to_a_CentOS_6_Volume_Group_and_Logical_Volume






share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409278%2fvirtualbox-dynamic-virtual-disk-wont-expand%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    Ok, I found what the problem was. My filesystem uses Logical Volume Management (LVM), which I have never worked with before, and so I didn't know how to properly handle it. Using LVM terminology, centos is a volume group:



    centos



    sda2 is a physical volume in that volume group:



    sda2



    and root is a logical volume in that volume group, along with swap:



    root



    The centos VG and the sda2 PV had already registered the extra storage I'd allocated, but all that was left was to allocate that extra space to the root LV (21504 is the number of free physical extents (PEs) that I got from vgdisplay):



    $ sudo lvextend /dev/centos/root /dev/sda2 -l+21504



    and then expand the root filesystem so that it could make use of this extra space:



    $ sudo xfs_growfs /dev/centos/root



    After this the guest OS recognized that it had extra space, and filling up this space causing a corresponding growth in the size of the virtual hard disk on the host OS. Success!



    Source:
    http://www.techotopia.com/index.php/Adding_a_New_Disk_to_a_CentOS_6_Volume_Group_and_Logical_Volume






    share|improve this answer


























      up vote
      1
      down vote



      accepted










      Ok, I found what the problem was. My filesystem uses Logical Volume Management (LVM), which I have never worked with before, and so I didn't know how to properly handle it. Using LVM terminology, centos is a volume group:



      centos



      sda2 is a physical volume in that volume group:



      sda2



      and root is a logical volume in that volume group, along with swap:



      root



      The centos VG and the sda2 PV had already registered the extra storage I'd allocated, but all that was left was to allocate that extra space to the root LV (21504 is the number of free physical extents (PEs) that I got from vgdisplay):



      $ sudo lvextend /dev/centos/root /dev/sda2 -l+21504



      and then expand the root filesystem so that it could make use of this extra space:



      $ sudo xfs_growfs /dev/centos/root



      After this the guest OS recognized that it had extra space, and filling up this space causing a corresponding growth in the size of the virtual hard disk on the host OS. Success!



      Source:
      http://www.techotopia.com/index.php/Adding_a_New_Disk_to_a_CentOS_6_Volume_Group_and_Logical_Volume






      share|improve this answer
























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        Ok, I found what the problem was. My filesystem uses Logical Volume Management (LVM), which I have never worked with before, and so I didn't know how to properly handle it. Using LVM terminology, centos is a volume group:



        centos



        sda2 is a physical volume in that volume group:



        sda2



        and root is a logical volume in that volume group, along with swap:



        root



        The centos VG and the sda2 PV had already registered the extra storage I'd allocated, but all that was left was to allocate that extra space to the root LV (21504 is the number of free physical extents (PEs) that I got from vgdisplay):



        $ sudo lvextend /dev/centos/root /dev/sda2 -l+21504



        and then expand the root filesystem so that it could make use of this extra space:



        $ sudo xfs_growfs /dev/centos/root



        After this the guest OS recognized that it had extra space, and filling up this space causing a corresponding growth in the size of the virtual hard disk on the host OS. Success!



        Source:
        http://www.techotopia.com/index.php/Adding_a_New_Disk_to_a_CentOS_6_Volume_Group_and_Logical_Volume






        share|improve this answer














        Ok, I found what the problem was. My filesystem uses Logical Volume Management (LVM), which I have never worked with before, and so I didn't know how to properly handle it. Using LVM terminology, centos is a volume group:



        centos



        sda2 is a physical volume in that volume group:



        sda2



        and root is a logical volume in that volume group, along with swap:



        root



        The centos VG and the sda2 PV had already registered the extra storage I'd allocated, but all that was left was to allocate that extra space to the root LV (21504 is the number of free physical extents (PEs) that I got from vgdisplay):



        $ sudo lvextend /dev/centos/root /dev/sda2 -l+21504



        and then expand the root filesystem so that it could make use of this extra space:



        $ sudo xfs_growfs /dev/centos/root



        After this the guest OS recognized that it had extra space, and filling up this space causing a corresponding growth in the size of the virtual hard disk on the host OS. Success!



        Source:
        http://www.techotopia.com/index.php/Adding_a_New_Disk_to_a_CentOS_6_Volume_Group_and_Logical_Volume







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 7 '17 at 17:17

























        answered Dec 7 '17 at 17:05









        Connor Howington

        165




        165



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409278%2fvirtualbox-dynamic-virtual-disk-wont-expand%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay