2

I installed my Ubuntu system without using LVM, but now the disk space is insufficient. I want to buy a new disk. Is it possible to extend the space using LVM now?

I have searched a lot, and almost every post I found explains how to extend space using LVM. They can use LVM because they initially installed the system with LVM. However, my problem is that I installed the system without using LVM. Is it too late to use LVM now?

If it is too late, are there any alternative methods to extend the space?

I have searched extensively on Google but haven't had any luck. I hope someone who is familiar with LVM can assist me.

vstar
  • 21
  • I never did such a thing before, but I think it is doable. Search the Internet for "Convert existing Root Filesystem to LVM Partition", but be very careful and have good backups before doing it! – FedKad Dec 27 '23 at 11:36
  • Thank you for your help, i'll have a try later. – vstar Dec 27 '23 at 12:26
  • Make sure you have set up an automatic periodic backup system. The problem with LVM spanning two disks is that if either of them fail (probably the older one will fail first) all the data including your personal files will be lost. – user68186 Jan 02 '24 at 23:26

2 Answers2

2

I'm not sure about LVM, but it's not too hard to move your /home folder to a second hard drive, e.g. Move home folder to second drive

Generally it is your personal files in /home that expand, the other OS files don't tend to change size over time that much.

This also has the advantage that after re-installing the OS you have access to all your settings and files by mounting /home again.

Tom
  • 526
0

Your question is a little confusing, it's unclear whether you are replacing your hard drive with a larger one or adding a new drive as further storage.

At any rate, LVM makes operations like this significantly more complex as you have to understand the extra levels of abstraction it gives and learn all the tools for managing these, which are different to the normal formatting and partitioning tools. Don't get me wrong, it has legitimate uses, but most of them don't apply to a personal device.

If you are adding a new drive and you want to expand your existing logical volume onto the new drive, you need to add the new drive as a PV (physical volume), add it to your existing VG (volume group), and then extend your LV (logical volume) onto the new space the previous steps created.

If you are replacing your existing drive with the new one, you can add the new drive as a PV (physical volume), add it to your existing VG (volume group), and then move (instead of extend) your LV (logical volume) so that it occupies only the space offered by the new PV, then remove the old drive's PV from your VG, and then remove the old drive from the PC. All is possible to do "live", which is the benefit of lvm, but it's an incredibly complex set of steps and personally I would just avoid lvm and do it the old fashioned way instead, and if I had LVM already I'd consider reinstalling without it.

The LVM system makes it hard to mess up in a way that will lose data but in doing so it ensures that if you don't know what you're doing you may be met with frequent error messages denying your chosen operation because you forgot or didn't fully understand some other step. You really do have to learn LVM to get through the process.

Doing what you want without LVM will be a lot easier and is what I'd recommend. It is a little harder to join two separate drives together and span a partition over them both, though, but there are other solutions for that - RAID or JBOD offer some solutions. But I'd be inclined to recommend just keeping them as separately mounted partitions anyway.

thomasrutter
  • 36,774