Question about LVM

I have my main installation on a ssd 500g in an old gaming pc. I’ve just added a sata drive for 2TB into the same box. I was reading this guide

It talks about creating a LV partition on the new drive to hold nextcloud when you install but if you already have it installed as I do then

This section
In case you are on an already running nextcloud instance

You have to:

  1. mount the partition to a temporary location (/mnt will do)
  2. stop your app
  3. move everything from /home/ to /mnt
  4. umount /mnt
  5. mount /dev/system/nextcloud /home/
  6. start your app


My clarification question is this:
I thought that the power of LVM was that it treated all drives as one big drive? If that is the case, shouldn’t it just expand to the new drive as I require more space?

Thanks in advance


Hi uncertain,

Telling that a random guide on the Internet did not work for you does not help us in helping you.

What is your situation? Did you use LVM on your original SSD as well?

If you did, check the hardware storage under LVM with pvs (available physical volumes) and use pvcreate on your new 2TB drive to make it available for LVM.

Use vgs to list the available volume groups to see which one you’d like to vgextend with the newly available physical volume.

You could first run lvs to get a list of available logical volumes and corresponding volume groups.

Keep in mind that this will extend your file system that is exclusively SSD now with, if I understand correctly, spinning disk. That is technically not a problem at all, but will lead to unpredictable performance as data is written randomly to SSD or HDD (the filesystem does not know it is running on LVM, and does not know part of it is SSD and part HDD).

If you’re in for some more confiuration, have some patience and time to read some theory (howto’s help, manpages on LVM are really good), I’d suggest a path similar to:

  1. I assume your SSD is one large volume group
  2. Partition HDD into multiple partitions, at least one of them some 510 GB (just a bit larger than your SSD, to be on the safe side) (fdisk)
  3. Create a physical volume on the new partition (pvcreate)
  4. Add that physical volume to your existing volume group (vgextend)
  5. Convert your existing logical volumes on your SSD to RAID1 / mirror, namely one copy on SSD and one copy in a logical volume in the extended group on your new HDD
  6. Let it settle for a while; data is duplicated in the background (lvs -a -o name,copy_percent,devices should say 100 after a while)
  7. Now there are two identical copies of your system, one on SSD and one on the partition of the HDD
  8. Take the SSD out of the RAID1, in doing so converting the logical volume to linear on the HDD
  9. Extend the volume group with the other partitions of your HDD
  10. Extend the logical volumes as much as needed
  11. Allow your filesystem to grow as much as needed; LVM can do that for you with the -r switch (resize FS)
  12. The SSD is still in the volume group. Remove the existing volumes from the SSD,
  13. Add a new logical volume on SSD as cache for the logical volume on your HDD (lvcreate --type cache-pool -L 300g -n ssdcache volumegroupname /dev/sdax)

The result of the whole exercise is:

  • Yunohost running on the 2 TB HDD drive, with a read/write cache of 300 GB on SSD and 200 GB spare volume group space on the SSD.
  • Benefits:
    • LVM automatically tracks usage and promotes often-used data from HDD to SSD
    • When writing chunks of data, performance comes close to writing to SSD
    • You actually are using cheaper HDD space
  • Drawbacks
    • Complex to set up for the first time
  • If needed, the SSD can be removed from the configuration with a single lvconvert with no downtime or data loss

If you only perform steps 1-7, the whole system is on HDD and is still usable, depending on the number of users of your Yunohost.

Whichever route you take (plain extending the SSD with HDD, or moving data to HDD either in combination with cache or not): do you have a backup of your valuable data?
Does that backup reside on another disk than the two involved in this game?

Good luck!

1 Like

Hi the @wbk ,

Thanks for the reply. It wasn’t a random guide but a YH tutorial on this site. I included the link but maybe you missed it?

Enlarge your storage with LVM.

Regarding backup:
This is a new install and I have backed up the instalation before I add any personal data. All personal data is backed up as well on different pc.

Thank you for points 1-7. I’ll do some reading up and see if I can get my head around that.




Hi uncertain,

My bad, sorry. I -one way or another- totally overlooked that part of your post! It is a nice and helpful tutorial, much better than my terse list :slight_smile:

Now I also understand your question,

LVM could indeed create one large section out of multiple partitions/disks. Qprq’s aim is not to create one very large partition, but multiple large, extendable partitions for apps that may need to grow

As with most things, there are multiple roads that lead to the same destination. You can use one large volume, as Qprq explains, but in that case you may run the risk that uploading a large amount of data fills the root partition (/), as everything is ‘just one large partition’.

By putting Nextcloud data in its own (extendable) partition, there is no risk of overflowing your root partition (and crashing your system). The only risk is that Nextcloud is filling its own partition, but, because of LVM, it can easily be extended.

Another nice side effect of following Qprq’s advice, is that you can keep your system, the databases, mail, and smaller apps on your fast SSD. Large files such as music, photos and movies from apps as Nextcloud or music libraries will go to the apps’ own partition, on the slower, but fast enough, and much larger HDD.

All in all, if you have not yet started work on my suggestion, I think the road that you intended to take with Qprq’s tutorial is a good choice.

If you need any more specific help, consider posting the output from the commands used in that post (such as lsblk, pvs, vgs and lvs)!

appologies for the late reply. I can see what he was getting at now and it makes sense.



1 Like