How to resize logical volume in Red Hat Linux

Multi tool use
Multi tool use

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











up vote
1
down vote

favorite
3












Please guide that how to do following tasks with executing command.



  • 1.Create a new physical volume, create a new volume group in the name of
    dataconresize, vg extent is 16.00MB.

  • 2.Create a new logical volume in the name of datacopyresize with the size of 50 extents and file system must ext4

  • 3.Then mount it under /dataresize

  • 4.Resize the logical volume, logical-data and it filesystem to 400MB.

  • 5.Resize the logical volume, logical-data and it filesystem to 600MB. Make sure that the filesystem contents remain intact.

Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.



I tried first three steps as follows.



fdisk /dev/vdb 


----- > Create the Partition and set it's type 8e (which is LVM type)



partprobe /dev/vdb 


-----> get the partition



pvcreate /dev/vdb1
vgcreate -s 16M dataconresize /dev/vdb1
vgdisplay


-----> Check the vg extent size, its should be this (PE Size 16.00 MiB)



lvcreate -l 50 -n datacopyresize dataconresize
lvdisplay


-----> Check the size of extents



mkfs.ext4 /dev/dataconresize/datacopyresize 


-----> Make a filesystem on it



mkdir -p /dataresize 


-----> Create Directory to mount on it



blkid /dev/dataconresize/datacopyresize 


-----> Get the UUID of /dev/datacontainer/datacopy



vim /etc/fstab 


-----> Create the mount point inside the fstab



UUID=C553-2BF5 /dataresize ext4 defaults 0 0 
mount -a

df -hT


-----> get the mount point of it



But I am stuck with task 4 and task 5.







share|improve this question


























    up vote
    1
    down vote

    favorite
    3












    Please guide that how to do following tasks with executing command.



    • 1.Create a new physical volume, create a new volume group in the name of
      dataconresize, vg extent is 16.00MB.

    • 2.Create a new logical volume in the name of datacopyresize with the size of 50 extents and file system must ext4

    • 3.Then mount it under /dataresize

    • 4.Resize the logical volume, logical-data and it filesystem to 400MB.

    • 5.Resize the logical volume, logical-data and it filesystem to 600MB. Make sure that the filesystem contents remain intact.

    Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.



    I tried first three steps as follows.



    fdisk /dev/vdb 


    ----- > Create the Partition and set it's type 8e (which is LVM type)



    partprobe /dev/vdb 


    -----> get the partition



    pvcreate /dev/vdb1
    vgcreate -s 16M dataconresize /dev/vdb1
    vgdisplay


    -----> Check the vg extent size, its should be this (PE Size 16.00 MiB)



    lvcreate -l 50 -n datacopyresize dataconresize
    lvdisplay


    -----> Check the size of extents



    mkfs.ext4 /dev/dataconresize/datacopyresize 


    -----> Make a filesystem on it



    mkdir -p /dataresize 


    -----> Create Directory to mount on it



    blkid /dev/dataconresize/datacopyresize 


    -----> Get the UUID of /dev/datacontainer/datacopy



    vim /etc/fstab 


    -----> Create the mount point inside the fstab



    UUID=C553-2BF5 /dataresize ext4 defaults 0 0 
    mount -a

    df -hT


    -----> get the mount point of it



    But I am stuck with task 4 and task 5.







    share|improve this question
























      up vote
      1
      down vote

      favorite
      3









      up vote
      1
      down vote

      favorite
      3






      3





      Please guide that how to do following tasks with executing command.



      • 1.Create a new physical volume, create a new volume group in the name of
        dataconresize, vg extent is 16.00MB.

      • 2.Create a new logical volume in the name of datacopyresize with the size of 50 extents and file system must ext4

      • 3.Then mount it under /dataresize

      • 4.Resize the logical volume, logical-data and it filesystem to 400MB.

      • 5.Resize the logical volume, logical-data and it filesystem to 600MB. Make sure that the filesystem contents remain intact.

      Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.



      I tried first three steps as follows.



      fdisk /dev/vdb 


      ----- > Create the Partition and set it's type 8e (which is LVM type)



      partprobe /dev/vdb 


      -----> get the partition



      pvcreate /dev/vdb1
      vgcreate -s 16M dataconresize /dev/vdb1
      vgdisplay


      -----> Check the vg extent size, its should be this (PE Size 16.00 MiB)



      lvcreate -l 50 -n datacopyresize dataconresize
      lvdisplay


      -----> Check the size of extents



      mkfs.ext4 /dev/dataconresize/datacopyresize 


      -----> Make a filesystem on it



      mkdir -p /dataresize 


      -----> Create Directory to mount on it



      blkid /dev/dataconresize/datacopyresize 


      -----> Get the UUID of /dev/datacontainer/datacopy



      vim /etc/fstab 


      -----> Create the mount point inside the fstab



      UUID=C553-2BF5 /dataresize ext4 defaults 0 0 
      mount -a

      df -hT


      -----> get the mount point of it



      But I am stuck with task 4 and task 5.







      share|improve this question














      Please guide that how to do following tasks with executing command.



      • 1.Create a new physical volume, create a new volume group in the name of
        dataconresize, vg extent is 16.00MB.

      • 2.Create a new logical volume in the name of datacopyresize with the size of 50 extents and file system must ext4

      • 3.Then mount it under /dataresize

      • 4.Resize the logical volume, logical-data and it filesystem to 400MB.

      • 5.Resize the logical volume, logical-data and it filesystem to 600MB. Make sure that the filesystem contents remain intact.

      Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.



      I tried first three steps as follows.



      fdisk /dev/vdb 


      ----- > Create the Partition and set it's type 8e (which is LVM type)



      partprobe /dev/vdb 


      -----> get the partition



      pvcreate /dev/vdb1
      vgcreate -s 16M dataconresize /dev/vdb1
      vgdisplay


      -----> Check the vg extent size, its should be this (PE Size 16.00 MiB)



      lvcreate -l 50 -n datacopyresize dataconresize
      lvdisplay


      -----> Check the size of extents



      mkfs.ext4 /dev/dataconresize/datacopyresize 


      -----> Make a filesystem on it



      mkdir -p /dataresize 


      -----> Create Directory to mount on it



      blkid /dev/dataconresize/datacopyresize 


      -----> Get the UUID of /dev/datacontainer/datacopy



      vim /etc/fstab 


      -----> Create the mount point inside the fstab



      UUID=C553-2BF5 /dataresize ext4 defaults 0 0 
      mount -a

      df -hT


      -----> get the mount point of it



      But I am stuck with task 4 and task 5.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 10 at 8:38









      Kiwy

      5,31243350




      5,31243350










      asked Apr 10 at 7:56









      Eranda Peiris

      307113




      307113




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.



          To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):



          resize2fs /dev/dataconresize/datacopyresize 400M
          lvresize -L 400M /dev/dataconresize/datacopyresize


          Then to extend it to 600 Mb, you first resize the LV and then the filesystem:



          lvresize -L 600M /dev/dataconresize/datacopyresize
          resize2fs /dev/dataconresize/datacopyresize 600M


          Note: you could use instead lvreduce to shrink the LV and lvextend to extend it; the advantage of lvresize is that it offers an unique command for both operations.
          Also, you could pass the --resizefs argument to lvresize to automatically resize the fs along with the LV, instead of using resize2fs; I suggest you try my method, which uses two separate commands, to better understand what you're doing.






          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%2f436710%2fhow-to-resize-logical-volume-in-red-hat-linux%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













            You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.



            To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):



            resize2fs /dev/dataconresize/datacopyresize 400M
            lvresize -L 400M /dev/dataconresize/datacopyresize


            Then to extend it to 600 Mb, you first resize the LV and then the filesystem:



            lvresize -L 600M /dev/dataconresize/datacopyresize
            resize2fs /dev/dataconresize/datacopyresize 600M


            Note: you could use instead lvreduce to shrink the LV and lvextend to extend it; the advantage of lvresize is that it offers an unique command for both operations.
            Also, you could pass the --resizefs argument to lvresize to automatically resize the fs along with the LV, instead of using resize2fs; I suggest you try my method, which uses two separate commands, to better understand what you're doing.






            share|improve this answer


























              up vote
              1
              down vote













              You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.



              To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):



              resize2fs /dev/dataconresize/datacopyresize 400M
              lvresize -L 400M /dev/dataconresize/datacopyresize


              Then to extend it to 600 Mb, you first resize the LV and then the filesystem:



              lvresize -L 600M /dev/dataconresize/datacopyresize
              resize2fs /dev/dataconresize/datacopyresize 600M


              Note: you could use instead lvreduce to shrink the LV and lvextend to extend it; the advantage of lvresize is that it offers an unique command for both operations.
              Also, you could pass the --resizefs argument to lvresize to automatically resize the fs along with the LV, instead of using resize2fs; I suggest you try my method, which uses two separate commands, to better understand what you're doing.






              share|improve this answer
























                up vote
                1
                down vote










                up vote
                1
                down vote









                You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.



                To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):



                resize2fs /dev/dataconresize/datacopyresize 400M
                lvresize -L 400M /dev/dataconresize/datacopyresize


                Then to extend it to 600 Mb, you first resize the LV and then the filesystem:



                lvresize -L 600M /dev/dataconresize/datacopyresize
                resize2fs /dev/dataconresize/datacopyresize 600M


                Note: you could use instead lvreduce to shrink the LV and lvextend to extend it; the advantage of lvresize is that it offers an unique command for both operations.
                Also, you could pass the --resizefs argument to lvresize to automatically resize the fs along with the LV, instead of using resize2fs; I suggest you try my method, which uses two separate commands, to better understand what you're doing.






                share|improve this answer














                You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.



                To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):



                resize2fs /dev/dataconresize/datacopyresize 400M
                lvresize -L 400M /dev/dataconresize/datacopyresize


                Then to extend it to 600 Mb, you first resize the LV and then the filesystem:



                lvresize -L 600M /dev/dataconresize/datacopyresize
                resize2fs /dev/dataconresize/datacopyresize 600M


                Note: you could use instead lvreduce to shrink the LV and lvextend to extend it; the advantage of lvresize is that it offers an unique command for both operations.
                Also, you could pass the --resizefs argument to lvresize to automatically resize the fs along with the LV, instead of using resize2fs; I suggest you try my method, which uses two separate commands, to better understand what you're doing.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 10 at 8:32

























                answered Apr 10 at 8:20









                dr01

                15.3k114768




                15.3k114768






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436710%2fhow-to-resize-logical-volume-in-red-hat-linux%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    xyYqUmT0d3exkBSXb6z79Iqv05uecZTYCmT HFVWDcUUVi3k3xBBs WZvUt6forNXl,yvBM8L3W7 MEp,Z9lYccJ393
                    07yNx,t s GFHp9CFOkn

                    Popular posts from this blog

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

                    How many registers does an x86_64 CPU actually have?

                    Displaying single band from multi-band raster using QGIS