Reformat lvm to ext4 and change mountpoint

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

up vote
0
down vote

favorite

I need the space of sda on either / or a specific mount like /data. How can I repartition / change the current layout to match the needed desire?


sda 8:0 0 2.7T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 2.7T 0 part
├─centos_hosted--by-root 253:0 0 50G 0 lvm /
├─centos_hosted--by-swap 253:1 0 15.8G 0 lvm [SWAP]
└─centos_hosted--by-home 253:2 0 2.7T 0 lvm /home

fstab

/dev/mapper/centos_hosted--by-root /                       xfs     defaults        0 0
UUID=428e7c4c-d50a-45cc-ac2e-ab7f21e39a69 /boot            xfs     defaults        0 0
/dev/mapper/centos_hosted--by-home /home                   xfs     defaults        0 0
/dev/mapper/centos_hosted--by-swap swap                    swap    defaults        0 0

The partition should be ext4. /home is empty so it wouldn’t care if it has to be wiped.
Is it possible to archieve it without reinstalling the whole server?

share|improve this question

  • Why does it have to be a new partition and specifically ext4-formatted? Can’t you just shrink an existing filesystem, lvreduce the LV it’s on, then lvextend -r the existing / LV?
    – n.st
    Nov 29 at 15:31

  • Oh, scratch the “shrink” part: XFS cannot be shrunk. Still, delete /home and extend / without creating a new partition?
    – n.st
    Nov 29 at 15:33

  • @n.st, my understanding is OP want ext4 filesystem. And root is xfs
    – Romeo Ninov
    Nov 29 at 21:00

  • @RomeoNinov I understand they want ext4, but I’d like to know why. Not to be rude, but from the question I get the impression that OP doesn’t know much about the differences between filesystems, so they might be asking for ext4 without a technical reason.
    – n.st
    Nov 29 at 23:13

up vote
0
down vote

favorite

I need the space of sda on either / or a specific mount like /data. How can I repartition / change the current layout to match the needed desire?


sda 8:0 0 2.7T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 2.7T 0 part
├─centos_hosted--by-root 253:0 0 50G 0 lvm /
├─centos_hosted--by-swap 253:1 0 15.8G 0 lvm [SWAP]
└─centos_hosted--by-home 253:2 0 2.7T 0 lvm /home

fstab

/dev/mapper/centos_hosted--by-root /                       xfs     defaults        0 0
UUID=428e7c4c-d50a-45cc-ac2e-ab7f21e39a69 /boot            xfs     defaults        0 0
/dev/mapper/centos_hosted--by-home /home                   xfs     defaults        0 0
/dev/mapper/centos_hosted--by-swap swap                    swap    defaults        0 0

The partition should be ext4. /home is empty so it wouldn’t care if it has to be wiped.
Is it possible to archieve it without reinstalling the whole server?

share|improve this question

  • Why does it have to be a new partition and specifically ext4-formatted? Can’t you just shrink an existing filesystem, lvreduce the LV it’s on, then lvextend -r the existing / LV?
    – n.st
    Nov 29 at 15:31

  • Oh, scratch the “shrink” part: XFS cannot be shrunk. Still, delete /home and extend / without creating a new partition?
    – n.st
    Nov 29 at 15:33

  • @n.st, my understanding is OP want ext4 filesystem. And root is xfs
    – Romeo Ninov
    Nov 29 at 21:00

  • @RomeoNinov I understand they want ext4, but I’d like to know why. Not to be rude, but from the question I get the impression that OP doesn’t know much about the differences between filesystems, so they might be asking for ext4 without a technical reason.
    – n.st
    Nov 29 at 23:13

up vote
0
down vote

favorite

up vote
0
down vote

favorite

I need the space of sda on either / or a specific mount like /data. How can I repartition / change the current layout to match the needed desire?


sda 8:0 0 2.7T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 2.7T 0 part
├─centos_hosted--by-root 253:0 0 50G 0 lvm /
├─centos_hosted--by-swap 253:1 0 15.8G 0 lvm [SWAP]
└─centos_hosted--by-home 253:2 0 2.7T 0 lvm /home

fstab

/dev/mapper/centos_hosted--by-root /                       xfs     defaults        0 0
UUID=428e7c4c-d50a-45cc-ac2e-ab7f21e39a69 /boot            xfs     defaults        0 0
/dev/mapper/centos_hosted--by-home /home                   xfs     defaults        0 0
/dev/mapper/centos_hosted--by-swap swap                    swap    defaults        0 0

The partition should be ext4. /home is empty so it wouldn’t care if it has to be wiped.
Is it possible to archieve it without reinstalling the whole server?

share|improve this question

I need the space of sda on either / or a specific mount like /data. How can I repartition / change the current layout to match the needed desire?


sda 8:0 0 2.7T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 2.7T 0 part
├─centos_hosted--by-root 253:0 0 50G 0 lvm /
├─centos_hosted--by-swap 253:1 0 15.8G 0 lvm [SWAP]
└─centos_hosted--by-home 253:2 0 2.7T 0 lvm /home

fstab

/dev/mapper/centos_hosted--by-root /                       xfs     defaults        0 0
UUID=428e7c4c-d50a-45cc-ac2e-ab7f21e39a69 /boot            xfs     defaults        0 0
/dev/mapper/centos_hosted--by-home /home                   xfs     defaults        0 0
/dev/mapper/centos_hosted--by-swap swap                    swap    defaults        0 0

The partition should be ext4. /home is empty so it wouldn’t care if it has to be wiped.
Is it possible to archieve it without reinstalling the whole server?

partition lvm ext4

share|improve this question

share|improve this question

share|improve this question

share|improve this question

asked Nov 28 at 23:15

RononDeusEx

1

1

  • Why does it have to be a new partition and specifically ext4-formatted? Can’t you just shrink an existing filesystem, lvreduce the LV it’s on, then lvextend -r the existing / LV?
    – n.st
    Nov 29 at 15:31

  • Oh, scratch the “shrink” part: XFS cannot be shrunk. Still, delete /home and extend / without creating a new partition?
    – n.st
    Nov 29 at 15:33

  • @n.st, my understanding is OP want ext4 filesystem. And root is xfs
    – Romeo Ninov
    Nov 29 at 21:00

  • @RomeoNinov I understand they want ext4, but I’d like to know why. Not to be rude, but from the question I get the impression that OP doesn’t know much about the differences between filesystems, so they might be asking for ext4 without a technical reason.
    – n.st
    Nov 29 at 23:13

  • Why does it have to be a new partition and specifically ext4-formatted? Can’t you just shrink an existing filesystem, lvreduce the LV it’s on, then lvextend -r the existing / LV?
    – n.st
    Nov 29 at 15:31

  • Oh, scratch the “shrink” part: XFS cannot be shrunk. Still, delete /home and extend / without creating a new partition?
    – n.st
    Nov 29 at 15:33

  • @n.st, my understanding is OP want ext4 filesystem. And root is xfs
    – Romeo Ninov
    Nov 29 at 21:00

  • @RomeoNinov I understand they want ext4, but I’d like to know why. Not to be rude, but from the question I get the impression that OP doesn’t know much about the differences between filesystems, so they might be asking for ext4 without a technical reason.
    – n.st
    Nov 29 at 23:13

Why does it have to be a new partition and specifically ext4-formatted? Can’t you just shrink an existing filesystem, lvreduce the LV it’s on, then lvextend -r the existing / LV?
– n.st
Nov 29 at 15:31

Why does it have to be a new partition and specifically ext4-formatted? Can’t you just shrink an existing filesystem, lvreduce the LV it’s on, then lvextend -r the existing / LV?
– n.st
Nov 29 at 15:31

Oh, scratch the “shrink” part: XFS cannot be shrunk. Still, delete /home and extend / without creating a new partition?
– n.st
Nov 29 at 15:33

Oh, scratch the “shrink” part: XFS cannot be shrunk. Still, delete /home and extend / without creating a new partition?
– n.st
Nov 29 at 15:33

@n.st, my understanding is OP want ext4 filesystem. And root is xfs
– Romeo Ninov
Nov 29 at 21:00

@n.st, my understanding is OP want ext4 filesystem. And root is xfs
– Romeo Ninov
Nov 29 at 21:00

@RomeoNinov I understand they want ext4, but I’d like to know why. Not to be rude, but from the question I get the impression that OP doesn’t know much about the differences between filesystems, so they might be asking for ext4 without a technical reason.
– n.st
Nov 29 at 23:13

@RomeoNinov I understand they want ext4, but I’d like to know why. Not to be rude, but from the question I get the impression that OP doesn’t know much about the differences between filesystems, so they might be asking for ext4 without a technical reason.
– n.st
Nov 29 at 23:13

1 Answer
1

active

oldest

votes

up vote
1
down vote

THe process is sample (if /home is fine to be destroyed)
Exec following commands (as root)

umount /home
lvremove /dev/mapper/centos_hosted--by-home
#if the name of volume group is centos_hosted--by
lvcreate -n centos_hosted--by-data -L 100G centos_hosted--by 
mkfs.ext4 /dev/mapper/centos_hosted--by-data
mkdir -p /data
mount /dev/mapper/centos_hosted--by-data /data

Edit /etc/fstab and replace /home with /data and centos_hosted--by-home with centos_hosted--by-data. Also change xfs in this line with ext4

If you want to see the name of volume group exec command vgs

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: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: “”,
    imageUploader: {
    brandingHtml: “Powered by u003ca class=”icon-imgur-white” href=”https://imgur.com/”u003eu003c/au003e”,
    contentPolicyHtml: “User contributions licensed under u003ca href=”https://creativecommons.org/licenses/by-sa/3.0/”u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href=”https://stackoverflow.com/legal/content-policy”u003e(content policy)u003c/au003e”,
    allowUrls: true
    },
    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%2f484794%2freformat-lvm-to-ext4-and-change-mountpoint%23new-answer’, ‘question_page’);
    }
    );

    Post as a guest

    Required, but never shown

    1 Answer
    1

    active

    oldest

    votes

    1 Answer
    1

    active

    oldest

    votes

    active

    oldest

    votes

    active

    oldest

    votes

    up vote
    1
    down vote

    THe process is sample (if /home is fine to be destroyed)
    Exec following commands (as root)

    umount /home
    lvremove /dev/mapper/centos_hosted--by-home
    #if the name of volume group is centos_hosted--by
    lvcreate -n centos_hosted--by-data -L 100G centos_hosted--by 
    mkfs.ext4 /dev/mapper/centos_hosted--by-data
    mkdir -p /data
    mount /dev/mapper/centos_hosted--by-data /data
    

    Edit /etc/fstab and replace /home with /data and centos_hosted--by-home with centos_hosted--by-data. Also change xfs in this line with ext4

    If you want to see the name of volume group exec command vgs

    share|improve this answer

      up vote
      1
      down vote

      THe process is sample (if /home is fine to be destroyed)
      Exec following commands (as root)

      umount /home
      lvremove /dev/mapper/centos_hosted--by-home
      #if the name of volume group is centos_hosted--by
      lvcreate -n centos_hosted--by-data -L 100G centos_hosted--by 
      mkfs.ext4 /dev/mapper/centos_hosted--by-data
      mkdir -p /data
      mount /dev/mapper/centos_hosted--by-data /data
      

      Edit /etc/fstab and replace /home with /data and centos_hosted--by-home with centos_hosted--by-data. Also change xfs in this line with ext4

      If you want to see the name of volume group exec command vgs

      share|improve this answer

        up vote
        1
        down vote

        up vote
        1
        down vote

        THe process is sample (if /home is fine to be destroyed)
        Exec following commands (as root)

        umount /home
        lvremove /dev/mapper/centos_hosted--by-home
        #if the name of volume group is centos_hosted--by
        lvcreate -n centos_hosted--by-data -L 100G centos_hosted--by 
        mkfs.ext4 /dev/mapper/centos_hosted--by-data
        mkdir -p /data
        mount /dev/mapper/centos_hosted--by-data /data
        

        Edit /etc/fstab and replace /home with /data and centos_hosted--by-home with centos_hosted--by-data. Also change xfs in this line with ext4

        If you want to see the name of volume group exec command vgs

        share|improve this answer

        THe process is sample (if /home is fine to be destroyed)
        Exec following commands (as root)

        umount /home
        lvremove /dev/mapper/centos_hosted--by-home
        #if the name of volume group is centos_hosted--by
        lvcreate -n centos_hosted--by-data -L 100G centos_hosted--by 
        mkfs.ext4 /dev/mapper/centos_hosted--by-data
        mkdir -p /data
        mount /dev/mapper/centos_hosted--by-data /data
        

        Edit /etc/fstab and replace /home with /data and centos_hosted--by-home with centos_hosted--by-data. Also change xfs in this line with ext4

        If you want to see the name of volume group exec command vgs

        share|improve this answer

        share|improve this answer

        share|improve this answer

        edited Nov 29 at 14:36

        answered Nov 29 at 13:33

        Romeo Ninov

        5,02431627

        5,02431627

            draft saved
            draft discarded

            Thanks for contributing an answer to Unix & Linux Stack Exchange!

            • Please be sure to answer the question. Provide details and share your research!

            But avoid

            • Asking for help, clarification, or responding to other answers.
            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.

            Some of your past answers have not been well-received, and you’re in danger of being blocked from answering.

            Please pay close attention to the following guidance:

            • Please be sure to answer the question. Provide details and share your research!

            But avoid

            • Asking for help, clarification, or responding to other answers.
            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.

            draft saved

            draft discarded

            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2funix.stackexchange.com%2fquestions%2f484794%2freformat-lvm-to-ext4-and-change-mountpoint%23new-answer’, ‘question_page’);
            }
            );

            Post as a guest

            Required, but never shown

            Required, but never shown

            Required, but never shown

            Required, but never shown

            Required, but never shown

            Required, but never shown

            Required, but never shown

            Required, but never shown

            Required, but never shown

            Related Post

            Leave a Reply

            Your email address will not be published. Required fields are marked *