How shall I split a partition containing `/` and `/home` into two logical volumes?












0















I have a laptop running Lubuntu 18.04, with a single hard drive as a bootable disk, and two partitions on it: EFI System Partition and a bigger partition contains everything else (e.g. / an /home).



$ sudo parted -l
Model: ATA TOSHIBA MQ01ABF0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
2 538MB 500GB 500GB ext4


I want to separate / and /home in some way, so that messing up with / will have limited interference with /home. For example, I am considering to separate them into two different logical volumes using LVM, as suggested by Stephen Kill below. But it seems that I can't mark the bigger partition as a physical volume, so what shall I do now? (If this can help, besides the laptop, I have a Lubuntu bootable flash drive and another laptop also running Lubuntu 18.04).



$ sudo lvmdiskscan
/dev/sda1 [ 512.00 MiB]
/dev/sda2 [ <465.26 GiB]
0 disks
2 partitions
0 LVM physical volume whole disks
0 LVM physical volumes

$ sudo pvcreate /dev/sda2
Can't open /dev/sda2 exclusively. Mounted filesystem?


If I can afford to reinstall Lubuntu on the laptop, will reinstalling the OS help to separate / an /home into different logical volumes? How shall I do exactly?



If I don't want to reinstall Lubuntu on the laptop, what shall I do then?



Did telcoM and Stephen Kitt recommended the same? What are the steps so that I can follow their suggestions respectively?



telcoM wrote:




The problem is that you cannot just add LVM to an existing non-LVM
partition. You would have to shrink your existing partition as much as
you can, then create a new partition to be used as a LVM PV, create
the LV(s) you desire into it, copy the data, update your boot
configuration and initramfs to be aware of LVM, then boot to the LVM
version of the system, and then either repurpose the old non-LVM
partition as a second LVM PV on the same disk and add it to the
existing VG, or remove it and resize the only LVM PV on the disk.




Stephen Kitt wrote




On bootable disks, I have whatever partitions are needed to boot the
system (such as the ESP on EFI systems, or /boot on BIOS or U-boot
systems), and one big partition occupying all the available space,
which is used as a PV in LVM.



you can have one partition for the ESP, and another partition which
you use with LVM: that large partition (/dev/sda2) is a PV, used in a
VG, containing however many LVs you want (one for / and one for /home)











share|improve this question





























    0















    I have a laptop running Lubuntu 18.04, with a single hard drive as a bootable disk, and two partitions on it: EFI System Partition and a bigger partition contains everything else (e.g. / an /home).



    $ sudo parted -l
    Model: ATA TOSHIBA MQ01ABF0 (scsi)
    Disk /dev/sda: 500GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:

    Number Start End Size File system Name Flags
    1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
    2 538MB 500GB 500GB ext4


    I want to separate / and /home in some way, so that messing up with / will have limited interference with /home. For example, I am considering to separate them into two different logical volumes using LVM, as suggested by Stephen Kill below. But it seems that I can't mark the bigger partition as a physical volume, so what shall I do now? (If this can help, besides the laptop, I have a Lubuntu bootable flash drive and another laptop also running Lubuntu 18.04).



    $ sudo lvmdiskscan
    /dev/sda1 [ 512.00 MiB]
    /dev/sda2 [ <465.26 GiB]
    0 disks
    2 partitions
    0 LVM physical volume whole disks
    0 LVM physical volumes

    $ sudo pvcreate /dev/sda2
    Can't open /dev/sda2 exclusively. Mounted filesystem?


    If I can afford to reinstall Lubuntu on the laptop, will reinstalling the OS help to separate / an /home into different logical volumes? How shall I do exactly?



    If I don't want to reinstall Lubuntu on the laptop, what shall I do then?



    Did telcoM and Stephen Kitt recommended the same? What are the steps so that I can follow their suggestions respectively?



    telcoM wrote:




    The problem is that you cannot just add LVM to an existing non-LVM
    partition. You would have to shrink your existing partition as much as
    you can, then create a new partition to be used as a LVM PV, create
    the LV(s) you desire into it, copy the data, update your boot
    configuration and initramfs to be aware of LVM, then boot to the LVM
    version of the system, and then either repurpose the old non-LVM
    partition as a second LVM PV on the same disk and add it to the
    existing VG, or remove it and resize the only LVM PV on the disk.




    Stephen Kitt wrote




    On bootable disks, I have whatever partitions are needed to boot the
    system (such as the ESP on EFI systems, or /boot on BIOS or U-boot
    systems), and one big partition occupying all the available space,
    which is used as a PV in LVM.



    you can have one partition for the ESP, and another partition which
    you use with LVM: that large partition (/dev/sda2) is a PV, used in a
    VG, containing however many LVs you want (one for / and one for /home)











    share|improve this question



























      0












      0








      0








      I have a laptop running Lubuntu 18.04, with a single hard drive as a bootable disk, and two partitions on it: EFI System Partition and a bigger partition contains everything else (e.g. / an /home).



      $ sudo parted -l
      Model: ATA TOSHIBA MQ01ABF0 (scsi)
      Disk /dev/sda: 500GB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags:

      Number Start End Size File system Name Flags
      1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
      2 538MB 500GB 500GB ext4


      I want to separate / and /home in some way, so that messing up with / will have limited interference with /home. For example, I am considering to separate them into two different logical volumes using LVM, as suggested by Stephen Kill below. But it seems that I can't mark the bigger partition as a physical volume, so what shall I do now? (If this can help, besides the laptop, I have a Lubuntu bootable flash drive and another laptop also running Lubuntu 18.04).



      $ sudo lvmdiskscan
      /dev/sda1 [ 512.00 MiB]
      /dev/sda2 [ <465.26 GiB]
      0 disks
      2 partitions
      0 LVM physical volume whole disks
      0 LVM physical volumes

      $ sudo pvcreate /dev/sda2
      Can't open /dev/sda2 exclusively. Mounted filesystem?


      If I can afford to reinstall Lubuntu on the laptop, will reinstalling the OS help to separate / an /home into different logical volumes? How shall I do exactly?



      If I don't want to reinstall Lubuntu on the laptop, what shall I do then?



      Did telcoM and Stephen Kitt recommended the same? What are the steps so that I can follow their suggestions respectively?



      telcoM wrote:




      The problem is that you cannot just add LVM to an existing non-LVM
      partition. You would have to shrink your existing partition as much as
      you can, then create a new partition to be used as a LVM PV, create
      the LV(s) you desire into it, copy the data, update your boot
      configuration and initramfs to be aware of LVM, then boot to the LVM
      version of the system, and then either repurpose the old non-LVM
      partition as a second LVM PV on the same disk and add it to the
      existing VG, or remove it and resize the only LVM PV on the disk.




      Stephen Kitt wrote




      On bootable disks, I have whatever partitions are needed to boot the
      system (such as the ESP on EFI systems, or /boot on BIOS or U-boot
      systems), and one big partition occupying all the available space,
      which is used as a PV in LVM.



      you can have one partition for the ESP, and another partition which
      you use with LVM: that large partition (/dev/sda2) is a PV, used in a
      VG, containing however many LVs you want (one for / and one for /home)











      share|improve this question
















      I have a laptop running Lubuntu 18.04, with a single hard drive as a bootable disk, and two partitions on it: EFI System Partition and a bigger partition contains everything else (e.g. / an /home).



      $ sudo parted -l
      Model: ATA TOSHIBA MQ01ABF0 (scsi)
      Disk /dev/sda: 500GB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags:

      Number Start End Size File system Name Flags
      1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
      2 538MB 500GB 500GB ext4


      I want to separate / and /home in some way, so that messing up with / will have limited interference with /home. For example, I am considering to separate them into two different logical volumes using LVM, as suggested by Stephen Kill below. But it seems that I can't mark the bigger partition as a physical volume, so what shall I do now? (If this can help, besides the laptop, I have a Lubuntu bootable flash drive and another laptop also running Lubuntu 18.04).



      $ sudo lvmdiskscan
      /dev/sda1 [ 512.00 MiB]
      /dev/sda2 [ <465.26 GiB]
      0 disks
      2 partitions
      0 LVM physical volume whole disks
      0 LVM physical volumes

      $ sudo pvcreate /dev/sda2
      Can't open /dev/sda2 exclusively. Mounted filesystem?


      If I can afford to reinstall Lubuntu on the laptop, will reinstalling the OS help to separate / an /home into different logical volumes? How shall I do exactly?



      If I don't want to reinstall Lubuntu on the laptop, what shall I do then?



      Did telcoM and Stephen Kitt recommended the same? What are the steps so that I can follow their suggestions respectively?



      telcoM wrote:




      The problem is that you cannot just add LVM to an existing non-LVM
      partition. You would have to shrink your existing partition as much as
      you can, then create a new partition to be used as a LVM PV, create
      the LV(s) you desire into it, copy the data, update your boot
      configuration and initramfs to be aware of LVM, then boot to the LVM
      version of the system, and then either repurpose the old non-LVM
      partition as a second LVM PV on the same disk and add it to the
      existing VG, or remove it and resize the only LVM PV on the disk.




      Stephen Kitt wrote




      On bootable disks, I have whatever partitions are needed to boot the
      system (such as the ESP on EFI systems, or /boot on BIOS or U-boot
      systems), and one big partition occupying all the available space,
      which is used as a PV in LVM.



      you can have one partition for the ESP, and another partition which
      you use with LVM: that large partition (/dev/sda2) is a PV, used in a
      VG, containing however many LVs you want (one for / and one for /home)








      ubuntu partition lvm






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago







      Tim

















      asked 1 hour ago









      TimTim

      27.2k78262472




      27.2k78262472






















          0






          active

          oldest

          votes











          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',
          autoActivateHeartbeat: false,
          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%2f502437%2fhow-shall-i-split-a-partition-containing-and-home-into-two-logical-volume%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502437%2fhow-shall-i-split-a-partition-containing-and-home-into-two-logical-volume%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







          Popular posts from this blog

          CARDNET

          Boot-repair Failure: Unable to locate package grub-common:i386

          濃尾地震