How to resize the disk of an Ubuntu-VM correctly with GParted
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I use VirtualBox on Windows 10 to run a VM using Ubuntu 16.04.1 LTS.
I got the VM from my University with a disk size of 20GB which was way to optimistic ... so I want to resize it to 50GB
so I already did
- (on the host) Make a BackUp ;)
- (on the host) VBoxManage clonehd "source.vmdk" "clone.vdi" --format vdi
- (on the host) VBoxManage modifyhd "clone.vdi" --resize 51200
- (on the host) Downloaded GParted.iso
- (in the VM) Booted into GParted
- (in the VM) Expanded The Swap from 2GB to 4GB according to the RAM of the VM I also changed
Now I see the following image
As you can see obviously the new diskspace got added at the end of the disk. But now I'm facing the problem that I cannot expand the primary partition because the swap partition is "in the way". I neither am able to move the swap-partition.
How can I expand the primary partition and/or move the swap partition to the end of the disk?
The Idea I had was:
- Delete
/dev/sda5
- Delete
/dev/sda2
- Create new Partition
/dev/sda2
with file formatlinux-swap
and the end of the disk - Expand
/dev/sda1
to use the rest of the disk
Is this the way to go? Will Ubuntu automatically "know" where the swap partition will be after this action?
ubuntu partition gparted move-partition
 |Â
show 4 more comments
up vote
0
down vote
favorite
I use VirtualBox on Windows 10 to run a VM using Ubuntu 16.04.1 LTS.
I got the VM from my University with a disk size of 20GB which was way to optimistic ... so I want to resize it to 50GB
so I already did
- (on the host) Make a BackUp ;)
- (on the host) VBoxManage clonehd "source.vmdk" "clone.vdi" --format vdi
- (on the host) VBoxManage modifyhd "clone.vdi" --resize 51200
- (on the host) Downloaded GParted.iso
- (in the VM) Booted into GParted
- (in the VM) Expanded The Swap from 2GB to 4GB according to the RAM of the VM I also changed
Now I see the following image
As you can see obviously the new diskspace got added at the end of the disk. But now I'm facing the problem that I cannot expand the primary partition because the swap partition is "in the way". I neither am able to move the swap-partition.
How can I expand the primary partition and/or move the swap partition to the end of the disk?
The Idea I had was:
- Delete
/dev/sda5
- Delete
/dev/sda2
- Create new Partition
/dev/sda2
with file formatlinux-swap
and the end of the disk - Expand
/dev/sda1
to use the rest of the disk
Is this the way to go? Will Ubuntu automatically "know" where the swap partition will be after this action?
ubuntu partition gparted move-partition
If this is a new system, I would just set up logical volumes. That way you can set up partitions wherever you want and combine separate partitions to form file systems.
â Raman Sailopal
Oct 3 '17 at 13:32
Yeah but as I mentioned I got the System from the university (fully installed and with programs builded we have to use)
â derHugo
Oct 3 '17 at 13:33
Check if /dev/sda2 is in use first. If not, then you should be OK doing what you suggested,
â Raman Sailopal
Oct 3 '17 at 13:42
Ok it said used 0, so I did it now. Waiting for the boot .. how can I in general know, if Ubuntu is using my swap correctly?
â derHugo
Oct 3 '17 at 13:43
swapon -s will give you details regarding usage.
â Raman Sailopal
Oct 3 '17 at 13:46
 |Â
show 4 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I use VirtualBox on Windows 10 to run a VM using Ubuntu 16.04.1 LTS.
I got the VM from my University with a disk size of 20GB which was way to optimistic ... so I want to resize it to 50GB
so I already did
- (on the host) Make a BackUp ;)
- (on the host) VBoxManage clonehd "source.vmdk" "clone.vdi" --format vdi
- (on the host) VBoxManage modifyhd "clone.vdi" --resize 51200
- (on the host) Downloaded GParted.iso
- (in the VM) Booted into GParted
- (in the VM) Expanded The Swap from 2GB to 4GB according to the RAM of the VM I also changed
Now I see the following image
As you can see obviously the new diskspace got added at the end of the disk. But now I'm facing the problem that I cannot expand the primary partition because the swap partition is "in the way". I neither am able to move the swap-partition.
How can I expand the primary partition and/or move the swap partition to the end of the disk?
The Idea I had was:
- Delete
/dev/sda5
- Delete
/dev/sda2
- Create new Partition
/dev/sda2
with file formatlinux-swap
and the end of the disk - Expand
/dev/sda1
to use the rest of the disk
Is this the way to go? Will Ubuntu automatically "know" where the swap partition will be after this action?
ubuntu partition gparted move-partition
I use VirtualBox on Windows 10 to run a VM using Ubuntu 16.04.1 LTS.
I got the VM from my University with a disk size of 20GB which was way to optimistic ... so I want to resize it to 50GB
so I already did
- (on the host) Make a BackUp ;)
- (on the host) VBoxManage clonehd "source.vmdk" "clone.vdi" --format vdi
- (on the host) VBoxManage modifyhd "clone.vdi" --resize 51200
- (on the host) Downloaded GParted.iso
- (in the VM) Booted into GParted
- (in the VM) Expanded The Swap from 2GB to 4GB according to the RAM of the VM I also changed
Now I see the following image
As you can see obviously the new diskspace got added at the end of the disk. But now I'm facing the problem that I cannot expand the primary partition because the swap partition is "in the way". I neither am able to move the swap-partition.
How can I expand the primary partition and/or move the swap partition to the end of the disk?
The Idea I had was:
- Delete
/dev/sda5
- Delete
/dev/sda2
- Create new Partition
/dev/sda2
with file formatlinux-swap
and the end of the disk - Expand
/dev/sda1
to use the rest of the disk
Is this the way to go? Will Ubuntu automatically "know" where the swap partition will be after this action?
ubuntu partition gparted move-partition
ubuntu partition gparted move-partition
asked Oct 3 '17 at 13:15
derHugo
1125
1125
If this is a new system, I would just set up logical volumes. That way you can set up partitions wherever you want and combine separate partitions to form file systems.
â Raman Sailopal
Oct 3 '17 at 13:32
Yeah but as I mentioned I got the System from the university (fully installed and with programs builded we have to use)
â derHugo
Oct 3 '17 at 13:33
Check if /dev/sda2 is in use first. If not, then you should be OK doing what you suggested,
â Raman Sailopal
Oct 3 '17 at 13:42
Ok it said used 0, so I did it now. Waiting for the boot .. how can I in general know, if Ubuntu is using my swap correctly?
â derHugo
Oct 3 '17 at 13:43
swapon -s will give you details regarding usage.
â Raman Sailopal
Oct 3 '17 at 13:46
 |Â
show 4 more comments
If this is a new system, I would just set up logical volumes. That way you can set up partitions wherever you want and combine separate partitions to form file systems.
â Raman Sailopal
Oct 3 '17 at 13:32
Yeah but as I mentioned I got the System from the university (fully installed and with programs builded we have to use)
â derHugo
Oct 3 '17 at 13:33
Check if /dev/sda2 is in use first. If not, then you should be OK doing what you suggested,
â Raman Sailopal
Oct 3 '17 at 13:42
Ok it said used 0, so I did it now. Waiting for the boot .. how can I in general know, if Ubuntu is using my swap correctly?
â derHugo
Oct 3 '17 at 13:43
swapon -s will give you details regarding usage.
â Raman Sailopal
Oct 3 '17 at 13:46
If this is a new system, I would just set up logical volumes. That way you can set up partitions wherever you want and combine separate partitions to form file systems.
â Raman Sailopal
Oct 3 '17 at 13:32
If this is a new system, I would just set up logical volumes. That way you can set up partitions wherever you want and combine separate partitions to form file systems.
â Raman Sailopal
Oct 3 '17 at 13:32
Yeah but as I mentioned I got the System from the university (fully installed and with programs builded we have to use)
â derHugo
Oct 3 '17 at 13:33
Yeah but as I mentioned I got the System from the university (fully installed and with programs builded we have to use)
â derHugo
Oct 3 '17 at 13:33
Check if /dev/sda2 is in use first. If not, then you should be OK doing what you suggested,
â Raman Sailopal
Oct 3 '17 at 13:42
Check if /dev/sda2 is in use first. If not, then you should be OK doing what you suggested,
â Raman Sailopal
Oct 3 '17 at 13:42
Ok it said used 0, so I did it now. Waiting for the boot .. how can I in general know, if Ubuntu is using my swap correctly?
â derHugo
Oct 3 '17 at 13:43
Ok it said used 0, so I did it now. Waiting for the boot .. how can I in general know, if Ubuntu is using my swap correctly?
â derHugo
Oct 3 '17 at 13:43
swapon -s will give you details regarding usage.
â Raman Sailopal
Oct 3 '17 at 13:46
swapon -s will give you details regarding usage.
â Raman Sailopal
Oct 3 '17 at 13:46
 |Â
show 4 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
In this particular case, you can probably disable the swap space, move the swap partition, and re-enable it (swapoff dev/sda5
, move the partition, then swapon /dev/sda5
). Recreating the swap partition by hand as you suggested will likely cause Ubuntu to fail to recognize it (it will have a different UUID than the original swap partition, which in turn means it won't be automatically enabled).
The more generically useful (and arguably safer) option is to instead boot into a maintenance LiveCD (System Rescue CD is what I personally use for this, but there are other options, including one that is also called GParted and is designed specifically for this type of thing), and move and resize things from there as needed.
If you read my question carefully you see that I already used GParted(iso). My suggestion was doing those steps using the booted GParted. Ubuntu itself wasn't running when I made the changes so I would actually assume that also my fstab should have been applied automatically afaik?
â derHugo
Oct 4 '17 at 4:57
@derHugo Apologies, I missed that somehow. As far as/etc/fstab
, Ubuntu uses UUID's for mounting filesystems, so as long as you don't wipe and re-create filesystems or the swap partition, you can move partitions around all you want and it will still work without needing updates to/etc/fstab
. As far as moving the swap partition, GParted itself will complain about moving a partition, but you can safely do so here.
â Austin Hemmelgarn
Oct 4 '17 at 11:32
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
In this particular case, you can probably disable the swap space, move the swap partition, and re-enable it (swapoff dev/sda5
, move the partition, then swapon /dev/sda5
). Recreating the swap partition by hand as you suggested will likely cause Ubuntu to fail to recognize it (it will have a different UUID than the original swap partition, which in turn means it won't be automatically enabled).
The more generically useful (and arguably safer) option is to instead boot into a maintenance LiveCD (System Rescue CD is what I personally use for this, but there are other options, including one that is also called GParted and is designed specifically for this type of thing), and move and resize things from there as needed.
If you read my question carefully you see that I already used GParted(iso). My suggestion was doing those steps using the booted GParted. Ubuntu itself wasn't running when I made the changes so I would actually assume that also my fstab should have been applied automatically afaik?
â derHugo
Oct 4 '17 at 4:57
@derHugo Apologies, I missed that somehow. As far as/etc/fstab
, Ubuntu uses UUID's for mounting filesystems, so as long as you don't wipe and re-create filesystems or the swap partition, you can move partitions around all you want and it will still work without needing updates to/etc/fstab
. As far as moving the swap partition, GParted itself will complain about moving a partition, but you can safely do so here.
â Austin Hemmelgarn
Oct 4 '17 at 11:32
add a comment |Â
up vote
0
down vote
In this particular case, you can probably disable the swap space, move the swap partition, and re-enable it (swapoff dev/sda5
, move the partition, then swapon /dev/sda5
). Recreating the swap partition by hand as you suggested will likely cause Ubuntu to fail to recognize it (it will have a different UUID than the original swap partition, which in turn means it won't be automatically enabled).
The more generically useful (and arguably safer) option is to instead boot into a maintenance LiveCD (System Rescue CD is what I personally use for this, but there are other options, including one that is also called GParted and is designed specifically for this type of thing), and move and resize things from there as needed.
If you read my question carefully you see that I already used GParted(iso). My suggestion was doing those steps using the booted GParted. Ubuntu itself wasn't running when I made the changes so I would actually assume that also my fstab should have been applied automatically afaik?
â derHugo
Oct 4 '17 at 4:57
@derHugo Apologies, I missed that somehow. As far as/etc/fstab
, Ubuntu uses UUID's for mounting filesystems, so as long as you don't wipe and re-create filesystems or the swap partition, you can move partitions around all you want and it will still work without needing updates to/etc/fstab
. As far as moving the swap partition, GParted itself will complain about moving a partition, but you can safely do so here.
â Austin Hemmelgarn
Oct 4 '17 at 11:32
add a comment |Â
up vote
0
down vote
up vote
0
down vote
In this particular case, you can probably disable the swap space, move the swap partition, and re-enable it (swapoff dev/sda5
, move the partition, then swapon /dev/sda5
). Recreating the swap partition by hand as you suggested will likely cause Ubuntu to fail to recognize it (it will have a different UUID than the original swap partition, which in turn means it won't be automatically enabled).
The more generically useful (and arguably safer) option is to instead boot into a maintenance LiveCD (System Rescue CD is what I personally use for this, but there are other options, including one that is also called GParted and is designed specifically for this type of thing), and move and resize things from there as needed.
In this particular case, you can probably disable the swap space, move the swap partition, and re-enable it (swapoff dev/sda5
, move the partition, then swapon /dev/sda5
). Recreating the swap partition by hand as you suggested will likely cause Ubuntu to fail to recognize it (it will have a different UUID than the original swap partition, which in turn means it won't be automatically enabled).
The more generically useful (and arguably safer) option is to instead boot into a maintenance LiveCD (System Rescue CD is what I personally use for this, but there are other options, including one that is also called GParted and is designed specifically for this type of thing), and move and resize things from there as needed.
answered Oct 3 '17 at 18:34
Austin Hemmelgarn
5,2041915
5,2041915
If you read my question carefully you see that I already used GParted(iso). My suggestion was doing those steps using the booted GParted. Ubuntu itself wasn't running when I made the changes so I would actually assume that also my fstab should have been applied automatically afaik?
â derHugo
Oct 4 '17 at 4:57
@derHugo Apologies, I missed that somehow. As far as/etc/fstab
, Ubuntu uses UUID's for mounting filesystems, so as long as you don't wipe and re-create filesystems or the swap partition, you can move partitions around all you want and it will still work without needing updates to/etc/fstab
. As far as moving the swap partition, GParted itself will complain about moving a partition, but you can safely do so here.
â Austin Hemmelgarn
Oct 4 '17 at 11:32
add a comment |Â
If you read my question carefully you see that I already used GParted(iso). My suggestion was doing those steps using the booted GParted. Ubuntu itself wasn't running when I made the changes so I would actually assume that also my fstab should have been applied automatically afaik?
â derHugo
Oct 4 '17 at 4:57
@derHugo Apologies, I missed that somehow. As far as/etc/fstab
, Ubuntu uses UUID's for mounting filesystems, so as long as you don't wipe and re-create filesystems or the swap partition, you can move partitions around all you want and it will still work without needing updates to/etc/fstab
. As far as moving the swap partition, GParted itself will complain about moving a partition, but you can safely do so here.
â Austin Hemmelgarn
Oct 4 '17 at 11:32
If you read my question carefully you see that I already used GParted(iso). My suggestion was doing those steps using the booted GParted. Ubuntu itself wasn't running when I made the changes so I would actually assume that also my fstab should have been applied automatically afaik?
â derHugo
Oct 4 '17 at 4:57
If you read my question carefully you see that I already used GParted(iso). My suggestion was doing those steps using the booted GParted. Ubuntu itself wasn't running when I made the changes so I would actually assume that also my fstab should have been applied automatically afaik?
â derHugo
Oct 4 '17 at 4:57
@derHugo Apologies, I missed that somehow. As far as
/etc/fstab
, Ubuntu uses UUID's for mounting filesystems, so as long as you don't wipe and re-create filesystems or the swap partition, you can move partitions around all you want and it will still work without needing updates to /etc/fstab
. As far as moving the swap partition, GParted itself will complain about moving a partition, but you can safely do so here.â Austin Hemmelgarn
Oct 4 '17 at 11:32
@derHugo Apologies, I missed that somehow. As far as
/etc/fstab
, Ubuntu uses UUID's for mounting filesystems, so as long as you don't wipe and re-create filesystems or the swap partition, you can move partitions around all you want and it will still work without needing updates to /etc/fstab
. As far as moving the swap partition, GParted itself will complain about moving a partition, but you can safely do so here.â Austin Hemmelgarn
Oct 4 '17 at 11:32
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%2f395835%2fhow-to-resize-the-disk-of-an-ubuntu-vm-correctly-with-gparted%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
If this is a new system, I would just set up logical volumes. That way you can set up partitions wherever you want and combine separate partitions to form file systems.
â Raman Sailopal
Oct 3 '17 at 13:32
Yeah but as I mentioned I got the System from the university (fully installed and with programs builded we have to use)
â derHugo
Oct 3 '17 at 13:33
Check if /dev/sda2 is in use first. If not, then you should be OK doing what you suggested,
â Raman Sailopal
Oct 3 '17 at 13:42
Ok it said used 0, so I did it now. Waiting for the boot .. how can I in general know, if Ubuntu is using my swap correctly?
â derHugo
Oct 3 '17 at 13:43
swapon -s will give you details regarding usage.
â Raman Sailopal
Oct 3 '17 at 13:46