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? (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?
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.
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)