Extend partition into grown volume

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











up vote
2
down vote

favorite
1












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










share|improve this question

























    up vote
    2
    down vote

    favorite
    1












    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










    share|improve this question























      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      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










      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 8 at 8:54









      Ben

      132




      132




















          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 2 and, looking at the numbers from the partition table, input the new start and end positions for partition move has been removed in later versions of parted, 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.






          share|improve this answer






















          • 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











          • I have revised my answer based on this.
            – user10186512
            Aug 8 at 10:05










          • All sorted. Thanks!
            – Ben
            Aug 8 at 10:27










          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%2f461231%2fextend-partition-into-grown-volume%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










          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 2 and, looking at the numbers from the partition table, input the new start and end positions for partition move has been removed in later versions of parted, 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.






          share|improve this answer






















          • 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











          • I have revised my answer based on this.
            – user10186512
            Aug 8 at 10:05










          • All sorted. Thanks!
            – Ben
            Aug 8 at 10:27














          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 2 and, looking at the numbers from the partition table, input the new start and end positions for partition move has been removed in later versions of parted, 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.






          share|improve this answer






















          • 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











          • I have revised my answer based on this.
            – user10186512
            Aug 8 at 10:05










          • All sorted. Thanks!
            – Ben
            Aug 8 at 10:27












          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 2 and, looking at the numbers from the partition table, input the new start and end positions for partition move has been removed in later versions of parted, 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.






          share|improve this answer














          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 2 and, looking at the numbers from the partition table, input the new start and end positions for partition move has been removed in later versions of parted, 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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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 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










          • 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











          • 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










          • 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

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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













































































          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