Extend partition into grown volume

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I had an Ubuntu VM which I imported into Amazon AWS. I then increased the volume size from 100GB to 1500GB.
How can I extend the partition to use all of the new space.
root@pbx-a:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 1.5T 0 disk
âÂÂâÂÂxvda1 202:1 0 97.4G 0 part /
âÂÂâÂÂxvda2 202:2 0 2.6G 0 part [SWAP]
root@pbx-a:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 100414960 34551944 61265148 37% /
none 4 0 4 0% /sys/fs/cgroup
udev 497332 4 497328 1% /dev
tmpfs 101604 364 101240 1% /run
none 5120 0 5120 0% /run/lock
none 508016 0 508016 0% /run/shm
none 102400 0 102400 0% /run/user
Thanks
linux ubuntu amazon-ec2
add a comment |Â
up vote
2
down vote
favorite
I had an Ubuntu VM which I imported into Amazon AWS. I then increased the volume size from 100GB to 1500GB.
How can I extend the partition to use all of the new space.
root@pbx-a:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 1.5T 0 disk
âÂÂâÂÂxvda1 202:1 0 97.4G 0 part /
âÂÂâÂÂxvda2 202:2 0 2.6G 0 part [SWAP]
root@pbx-a:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 100414960 34551944 61265148 37% /
none 4 0 4 0% /sys/fs/cgroup
udev 497332 4 497328 1% /dev
tmpfs 101604 364 101240 1% /run
none 5120 0 5120 0% /run/lock
none 508016 0 508016 0% /run/shm
none 102400 0 102400 0% /run/user
Thanks
linux ubuntu amazon-ec2
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I had an Ubuntu VM which I imported into Amazon AWS. I then increased the volume size from 100GB to 1500GB.
How can I extend the partition to use all of the new space.
root@pbx-a:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 1.5T 0 disk
âÂÂâÂÂxvda1 202:1 0 97.4G 0 part /
âÂÂâÂÂxvda2 202:2 0 2.6G 0 part [SWAP]
root@pbx-a:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 100414960 34551944 61265148 37% /
none 4 0 4 0% /sys/fs/cgroup
udev 497332 4 497328 1% /dev
tmpfs 101604 364 101240 1% /run
none 5120 0 5120 0% /run/lock
none 508016 0 508016 0% /run/shm
none 102400 0 102400 0% /run/user
Thanks
linux ubuntu amazon-ec2
I had an Ubuntu VM which I imported into Amazon AWS. I then increased the volume size from 100GB to 1500GB.
How can I extend the partition to use all of the new space.
root@pbx-a:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 1.5T 0 disk
âÂÂâÂÂxvda1 202:1 0 97.4G 0 part /
âÂÂâÂÂxvda2 202:2 0 2.6G 0 part [SWAP]
root@pbx-a:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 100414960 34551944 61265148 37% /
none 4 0 4 0% /sys/fs/cgroup
udev 497332 4 497328 1% /dev
tmpfs 101604 364 101240 1% /run
none 5120 0 5120 0% /run/lock
none 508016 0 508016 0% /run/shm
none 102400 0 102400 0% /run/user
Thanks
linux ubuntu amazon-ec2
linux ubuntu amazon-ec2
asked Aug 8 at 8:54
Ben
132
132
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
You first need to resize the actual xvda1 partition, eg. with parted. Because xvda2 is in the way, you'll need to disable it (swapoff /dev/xvda2), then remove it or move it during the re-partitioning process, and re-create it if removed and re-enable swap later if desired. Once xvda2 is no longer positioned immediately after xvda1, parted should simply let you resize xvda1 to fill the free space in between.
As for how to use parted, you usually want to start with print to show the current state of the partition table. If you want to move xvda2, simply run move has been removed in later versions of move 2 and, looking at the numbers from the partition table, input the new start and end positions for partitionparted, so just remove partition 2. After this, use resizepart 1 to resize partition 1 to the desired final size. If you left free space after partition 1, you can recreate xvda2 by running mkpart to create a new partition.
At this point, you should reboot so the partition table gets updated.
After this, assuming the partition on /dev/xvda1 is ext2, ext3 or ext4, running resize2fs /dev/xvda1 as root will automatically resize the partition to be as large as possible. For other types of partition live resizing might or might not be possible - for instance, with btrfs you would use btrfs filesystem resize max / to live-resize the filesystem mounted at / to its maximum available size.
It is ext4, I tried resizetofs /dev/xvda1. I got resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 25536768 blocks long. Nothing to do!
â Ben
Aug 8 at 9:45
My apologies, it seems I misread yourlsblkoutput. You might want to disable swap (swapoff /dev/xvda2), delete the partitionxvda2, resizexvda1to desired size, re-createxvda2in space you left over for it if necessary, then reboot, then runresize2fs.partedshould have all the functionality you need, including resize.
â user10186512
Aug 8 at 9:54
I have revised my answer based on this.
â user10186512
Aug 8 at 10:05
All sorted. Thanks!
â Ben
Aug 8 at 10:27
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
You first need to resize the actual xvda1 partition, eg. with parted. Because xvda2 is in the way, you'll need to disable it (swapoff /dev/xvda2), then remove it or move it during the re-partitioning process, and re-create it if removed and re-enable swap later if desired. Once xvda2 is no longer positioned immediately after xvda1, parted should simply let you resize xvda1 to fill the free space in between.
As for how to use parted, you usually want to start with print to show the current state of the partition table. If you want to move xvda2, simply run move has been removed in later versions of move 2 and, looking at the numbers from the partition table, input the new start and end positions for partitionparted, so just remove partition 2. After this, use resizepart 1 to resize partition 1 to the desired final size. If you left free space after partition 1, you can recreate xvda2 by running mkpart to create a new partition.
At this point, you should reboot so the partition table gets updated.
After this, assuming the partition on /dev/xvda1 is ext2, ext3 or ext4, running resize2fs /dev/xvda1 as root will automatically resize the partition to be as large as possible. For other types of partition live resizing might or might not be possible - for instance, with btrfs you would use btrfs filesystem resize max / to live-resize the filesystem mounted at / to its maximum available size.
It is ext4, I tried resizetofs /dev/xvda1. I got resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 25536768 blocks long. Nothing to do!
â Ben
Aug 8 at 9:45
My apologies, it seems I misread yourlsblkoutput. You might want to disable swap (swapoff /dev/xvda2), delete the partitionxvda2, resizexvda1to desired size, re-createxvda2in space you left over for it if necessary, then reboot, then runresize2fs.partedshould have all the functionality you need, including resize.
â user10186512
Aug 8 at 9:54
I have revised my answer based on this.
â user10186512
Aug 8 at 10:05
All sorted. Thanks!
â Ben
Aug 8 at 10:27
add a comment |Â
up vote
1
down vote
accepted
You first need to resize the actual xvda1 partition, eg. with parted. Because xvda2 is in the way, you'll need to disable it (swapoff /dev/xvda2), then remove it or move it during the re-partitioning process, and re-create it if removed and re-enable swap later if desired. Once xvda2 is no longer positioned immediately after xvda1, parted should simply let you resize xvda1 to fill the free space in between.
As for how to use parted, you usually want to start with print to show the current state of the partition table. If you want to move xvda2, simply run move has been removed in later versions of move 2 and, looking at the numbers from the partition table, input the new start and end positions for partitionparted, so just remove partition 2. After this, use resizepart 1 to resize partition 1 to the desired final size. If you left free space after partition 1, you can recreate xvda2 by running mkpart to create a new partition.
At this point, you should reboot so the partition table gets updated.
After this, assuming the partition on /dev/xvda1 is ext2, ext3 or ext4, running resize2fs /dev/xvda1 as root will automatically resize the partition to be as large as possible. For other types of partition live resizing might or might not be possible - for instance, with btrfs you would use btrfs filesystem resize max / to live-resize the filesystem mounted at / to its maximum available size.
It is ext4, I tried resizetofs /dev/xvda1. I got resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 25536768 blocks long. Nothing to do!
â Ben
Aug 8 at 9:45
My apologies, it seems I misread yourlsblkoutput. You might want to disable swap (swapoff /dev/xvda2), delete the partitionxvda2, resizexvda1to desired size, re-createxvda2in space you left over for it if necessary, then reboot, then runresize2fs.partedshould have all the functionality you need, including resize.
â user10186512
Aug 8 at 9:54
I have revised my answer based on this.
â user10186512
Aug 8 at 10:05
All sorted. Thanks!
â Ben
Aug 8 at 10:27
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You first need to resize the actual xvda1 partition, eg. with parted. Because xvda2 is in the way, you'll need to disable it (swapoff /dev/xvda2), then remove it or move it during the re-partitioning process, and re-create it if removed and re-enable swap later if desired. Once xvda2 is no longer positioned immediately after xvda1, parted should simply let you resize xvda1 to fill the free space in between.
As for how to use parted, you usually want to start with print to show the current state of the partition table. If you want to move xvda2, simply run move has been removed in later versions of move 2 and, looking at the numbers from the partition table, input the new start and end positions for partitionparted, so just remove partition 2. After this, use resizepart 1 to resize partition 1 to the desired final size. If you left free space after partition 1, you can recreate xvda2 by running mkpart to create a new partition.
At this point, you should reboot so the partition table gets updated.
After this, assuming the partition on /dev/xvda1 is ext2, ext3 or ext4, running resize2fs /dev/xvda1 as root will automatically resize the partition to be as large as possible. For other types of partition live resizing might or might not be possible - for instance, with btrfs you would use btrfs filesystem resize max / to live-resize the filesystem mounted at / to its maximum available size.
You first need to resize the actual xvda1 partition, eg. with parted. Because xvda2 is in the way, you'll need to disable it (swapoff /dev/xvda2), then remove it or move it during the re-partitioning process, and re-create it if removed and re-enable swap later if desired. Once xvda2 is no longer positioned immediately after xvda1, parted should simply let you resize xvda1 to fill the free space in between.
As for how to use parted, you usually want to start with print to show the current state of the partition table. If you want to move xvda2, simply run move has been removed in later versions of move 2 and, looking at the numbers from the partition table, input the new start and end positions for partitionparted, so just remove partition 2. After this, use resizepart 1 to resize partition 1 to the desired final size. If you left free space after partition 1, you can recreate xvda2 by running mkpart to create a new partition.
At this point, you should reboot so the partition table gets updated.
After this, assuming the partition on /dev/xvda1 is ext2, ext3 or ext4, running resize2fs /dev/xvda1 as root will automatically resize the partition to be as large as possible. For other types of partition live resizing might or might not be possible - for instance, with btrfs you would use btrfs filesystem resize max / to live-resize the filesystem mounted at / to its maximum available size.
edited Aug 8 at 10:02
answered Aug 8 at 9:26
user10186512
1263
1263
It is ext4, I tried resizetofs /dev/xvda1. I got resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 25536768 blocks long. Nothing to do!
â Ben
Aug 8 at 9:45
My apologies, it seems I misread yourlsblkoutput. You might want to disable swap (swapoff /dev/xvda2), delete the partitionxvda2, resizexvda1to desired size, re-createxvda2in space you left over for it if necessary, then reboot, then runresize2fs.partedshould have all the functionality you need, including resize.
â user10186512
Aug 8 at 9:54
I have revised my answer based on this.
â user10186512
Aug 8 at 10:05
All sorted. Thanks!
â Ben
Aug 8 at 10:27
add a comment |Â
It is ext4, I tried resizetofs /dev/xvda1. I got resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 25536768 blocks long. Nothing to do!
â Ben
Aug 8 at 9:45
My apologies, it seems I misread yourlsblkoutput. You might want to disable swap (swapoff /dev/xvda2), delete the partitionxvda2, resizexvda1to desired size, re-createxvda2in space you left over for it if necessary, then reboot, then runresize2fs.partedshould have all the functionality you need, including resize.
â user10186512
Aug 8 at 9:54
I have revised my answer based on this.
â user10186512
Aug 8 at 10:05
All sorted. Thanks!
â Ben
Aug 8 at 10:27
It is ext4, I tried resizetofs /dev/xvda1. I got resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 25536768 blocks long. Nothing to do!
â Ben
Aug 8 at 9:45
It is ext4, I tried resizetofs /dev/xvda1. I got resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 25536768 blocks long. Nothing to do!
â Ben
Aug 8 at 9:45
My apologies, it seems I misread your
lsblk output. You might want to disable swap (swapoff /dev/xvda2), delete the partition xvda2, resize xvda1 to desired size, re-create xvda2 in space you left over for it if necessary, then reboot, then run resize2fs. parted should have all the functionality you need, including resize.â user10186512
Aug 8 at 9:54
My apologies, it seems I misread your
lsblk output. You might want to disable swap (swapoff /dev/xvda2), delete the partition xvda2, resize xvda1 to desired size, re-create xvda2 in space you left over for it if necessary, then reboot, then run resize2fs. parted should have all the functionality you need, including resize.â user10186512
Aug 8 at 9:54
I have revised my answer based on this.
â user10186512
Aug 8 at 10:05
I have revised my answer based on this.
â user10186512
Aug 8 at 10:05
All sorted. Thanks!
â Ben
Aug 8 at 10:27
All sorted. Thanks!
â Ben
Aug 8 at 10:27
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%2f461231%2fextend-partition-into-grown-volume%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