VirtualBox - Dynamic virtual disk won't expand
Clash 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:
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.
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?
centos partition virtualbox virtual-machine gparted
add a comment |Â
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:
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.
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?
centos partition virtualbox virtual-machine gparted
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
add a comment |Â
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:
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.
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?
centos partition virtualbox virtual-machine gparted
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:
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.
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?
centos partition virtualbox virtual-machine gparted
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
add a comment |Â
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
add a comment |Â
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:
sda2 is a physical volume in that volume group:
and root is a logical volume in that volume group, along with swap:
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
add a comment |Â
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:
sda2 is a physical volume in that volume group:
and root is a logical volume in that volume group, along with swap:
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
add a comment |Â
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:
sda2 is a physical volume in that volume group:
and root is a logical volume in that volume group, along with swap:
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
add a comment |Â
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:
sda2 is a physical volume in that volume group:
and root is a logical volume in that volume group, along with swap:
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
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:
sda2 is a physical volume in that volume group:
and root is a logical volume in that volume group, along with swap:
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
edited Dec 7 '17 at 17:17
answered Dec 7 '17 at 17:05
Connor Howington
165
165
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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