I think the problem I was facing that motivated this question was that the Kubtuntu 18.04 installer did not allow you to create/modify the LVM other than the defaults i.e. if you did not want the LVM on the entire Disk, you had to do it manually. The way I solved this problem was:
- Use the Kubtuntu 18.04 USB/DVD and select the option Try (as against choosing Install).
- Once you get into this try to use the KDE Partition Manager, or just
parted
to create the partitions you want
Once Kubuntu loads (i.e. from the USB/DVD) with the option to Try, you have two options: Open the Konsole or use KDE Partition Manager. The discussion below is for the Konsole, but I think it is easier to use the KDE Partition Manager. All of this was done in a VM, hence the disk sizes are much smaller than you would expect for a typical HDD
Get into root
sudo -i
Figure out which disk you are going to instal using:
df -h
Sometimes you have to guess using the disk sizes
Assuming the disk is at /dev/sda, the following is the sequence of commands you can use in parted
.
parted /dev/sda
I’m doing MBR here, so for GPT your requirements would be differerent
mklabel msdos
Make the boot partition (The numbers specified are in MB):
mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext2
Start? 1
End? 1000
set 1 boot on
Make the Swap Partition
mkpart
Partition type? primary/extended? primary
File system type? [ext2]? linux-swap
Start? 1000
End? 2000
set 2 swap on <- Did not work, and I don’t know why
To observe your results
print free
To create the space for the LVM
Now we need to specify all of the remaining space. If you specify the MB, you leave some space at the end of the device. Hence I used %.
mkpart primary 2000 100%
set 3 lvm on
If you have an SSD, then do an align check
align-check opt 1
align-check opt 2
align-check opt 3
Finally quit parted using
q
Create filesystems on the boot and swap partitions
mkfs.ext2 /dev/sda1
mkswap /dev/sda2
Finally to create the LVM and format the space as ext4
pvcreate /dev/sda3
vgcreate vol_grp /dev/sda3
lvcreate -L 7GB -n root vol_grp
mkfs.ext4 /dev/vol_grp/root
Note: I have not used the entire space of the volume group because I wanted to use the rest of the space to create a snapshot when I have to backup root i.e. /
You can check your work using:
parted -l
Finally, reboot the machine with the Install Medium, and this time choose Install.
Run through the process. When you get to Disk Setup select Manual and then continue.
Here make the following changes:
Typo: Please read kubuntu in the above image as root
Select /dev/mapper/vol_grp/root
and hit Change
In the dialog that pops up set:
- Use as: Do not use this partition -> Ext4 Journaling file System
- Format: Upto you check/uncheck since we have already done the format above
- Mount Point -> /
Select /dev/sda1
and hit Change
In the dialog that pops up set:
- Use as: Ext2 Filesystem
- Format: Upto you
- Mount Point -> /boot
Finally at the bottom select
- Device for bootloader installation: /dev/sda1
Now you are set!! Let the Kubuntu installation proceed as usual.
Note: I think it is easier to use the KDE Partition Manager. In my further attempts esp. with disks bigger than the ones above, I have faced alignment issues, and I had no way to fix them. I noticed that KDE Partition Manager automatically handles the alignment for you. If not select the Align option under Advanced.