Ubuntu – How to resize / and add another logical volume without data loss

16.04filesystemlvmpartitioning

Ubuntu 16.04 installed with these settings "Erase Disk and install Ubuntu" with "Use LVM with the new Ubuntu installation". Now have 3 partitions:

  • /dev/sda1 mounted as /boot/efi
  • /dev/sda2 Linux file system mounted as /boot and
  • /dev/sda3 Linux LVM as 255 GB LVM2 PV with inside 2 Logical Volume /dev/ubuntu-vg/root (247 GB) and /dev/ubuntu-vg/swap_1 (8,5 GB).

Have searched for a clear and safe tutorial to be able to safely shrink the root partition to something like 30 GB (more or less) and create a new Logical Volume with the rest for a home/data partition.

Can't use system-config-lvm because of an error. The GUI shows up but doesn't display anything:

Unable to show VG because it contains features that are not supported in current version of system-config-lvm.

So I need to use the command line but not sure if it takes care of the data on the root partition (got a backup of important data).

Can anybody give me directions on what to do?

Best Answer

You need to try LVM terminal mode commands. For that you need to make sure that you have lvm2 package installed.

You can install it by typing:

sudo apt-get install lvm2

After this you can go through the following URLs and play with LVM.

https://www.howtoforge.com/linux_lvm https://wiki.ubuntu.com/Lvm

P.S.: Always use display commands first to view the present volume status. Then you can go for create/resize etc commands as per your need. Think twice before you press enter for resize/remove. I always prefer to do some test setups using a different machine with no important data, learn the thing properly and then apply on a machine with valuable data.

Related Question