Can I manually set up LVM?

10,526

Solution 1

I do this sort of thing all the time. Some tips:

  • You need to read the documentation, such as the sites Bujiraso referenced.
  • A tool like system-config-lvm (which is available with Ubuntu, but IIRC is not installed by default) can help by providing a GUI that makes it less necessary to remember the dozens of LVM text-mode commands (or even the half-dozen you're likely to use frequently). See this page (for CentOS, but applicable to Ubuntu) for information on using this tool.
  • Remember to create a separate /boot partition -- that is, not in the LVM setup. Make it at least 500 MB in size. (Over 1 GB would be overkill, though.) If there's any chance you'll ever install multiple Linux distributions (including future Ubuntu versions installed side-by-side with your current installation), be sure you set aside at least one to-be-/boot partition for each installation. (In theory, GRUB can boot from a kernel stored inside an LVM, but in practice this is rarely done, and I don't know how well Ubuntu would cope with this configuration. Some boot loaders don't enable booting in this way, so having a separate /boot partition expands your boot loader options.)
  • If you're using an EFI-based computer, you'll need a non-LVM EFI System Partition (ESP). I recommend making this one 550 MiB in size.
  • If you're booting from a GPT disk in BIOS/CSM/legacy mode, you'll need a ~1 MiB BIOS Boot Partition. On modern computers, I don't recommend this combination (BIOS-mode booting with GPT); most computers sold since late 2011 support EFI-mode booting, so I'd use that on such computers.
  • You can (but do not need to) create multiple LVM partitions (physical volumes). This gives you some flexibility for reconfiguring the system for multi-booting with non-Linux OSes in the future (or to split off space for additional /boot partitions, ESPs, etc). There's little or no advantage to this if you want to have one big Ubuntu installation; but for a heavily multi-booted system, having multiple PVs means you won't need to resize your PV to make room for some non-Linux OS you add in the future; just be sure one PV is empty, remove it from the volume group (VG), adjust its partition type code, and create a new filesystem on it.
  • You can boot the Ubuntu installation medium in its "try before installing" mode to use GParted and the LVM tools of your choice, then launch ubiquity (the Ubuntu installer) from the same boot to do the installation. Use the "something else" partitioning option (as described here). If the partition type codes are set correctly, Ubiquity should detect the ESP automatically, if it's present, and show the existing LVs. You'll need to explicitly identify your /boot partition and each LV you want to use.

Solution 2

It's of course possible to set up your own partition schemes, including those that use LVM, and the installer should let you set up your mount-points and install onto them. That being said, it may take some time, reading and experimentation. The Ubuntu wiki on LVM or Arch Linux page are two great places to start learning.

Personally, I've found automated installers to work best when you don't surprise them, so expect some hiccups if you have a fancy partition set-up going!

Share:
10,526

Related videos on Youtube

Askerman
Author by

Askerman

Updated on September 18, 2022

Comments

  • Askerman
    Askerman over 1 year

    Up until now, I have been using a standard partitioning scheme for my Ubuntu installation:

    - 4GB /swap
    - 30GB /
    - Rest of the HDD /home
    

    However, I am reinstalling the Ubuntu now and would like to use snapshots and the other things which LVM offers.

    The Ubuntu installer has a checkbox to install Ubuntu and set up LVM for it automatically, but I don't want to use this option, since I like to set up my partitions manually. That way, I can select things like the size of the swap partition, or size of the root partition and such, but alas, in the Ubuntu installer's manual partition tool, I don't see any option to create any LVM partition scheme or anything like that.

    Is it possible to set up the LVM manually like that, or is the only option to let Ubuntu do it on full auto, by ticking that LVM box?

    Thank you.