4

I have a Linux system (Opensuse leap, but it's not that important) installed on a logical volume (and the ext4 filesystem). I want to upgrade it to a newer version, but to be on the safe side, I want to create an LVM snapshot first in case something goes wrong.

My current LV does not have enough capacity to hold both the old version of the file system (on a snapshot) and the new version (after upgrade): the LV has 12GB, the files take 8 GB leaving 4 GB free. I can temporarily extend the LV to, say, 20 GB. Now: do I have to extend the filesystem to 20GB as well or can LVM leverage the space which is not allocated for the filesystem?

1
  • 2
    Looks, like I had misunderstood the whole concept of LVM snapshots. As Jaroslav Kucera pointed out, LVM keeps the snapshoted data in a separate volume. What I actually need is a free space outside of the volume in question, not inside it.
    – Jasio
    Sep 30, 2017 at 12:13

2 Answers 2

5

Actually for the snapshot you use different LV.

There is quite reasonable howto:

https://www.tecmint.com/take-snapshot-of-logical-volume-and-restore-in-lvm/

3

A Snapshot contains (some metadata and) copies of those (original i.e. from the moment of the snapshot creation) parts of the origin volume which have been writtem. Thus (except for the little metadata) a snapshot volume never needs to be larger than the origin volume.

4
  • If I have 8 GB of files, create a snapshot and then modify all of the files, I will need 8 GB for the old contents (a snapshot) and 8 GB for the new contents, right? Or am I missing something?
    – Jasio
    Sep 30, 2017 at 10:38
  • @Jasio You need 8G for the LV and another 8G for the snapshot. But if you are overwriting the whole LV anyway then it might make more sense to create another LV of exactly the same size and make an image copy of it with dd. Sep 30, 2017 at 11:16
  • Thank you. I made a partition image copy during past upgrades. But it's a time-consumig process, so I thought that LVM would help me save some time.
    – Jasio
    Sep 30, 2017 at 12:37
  • @Jasio With a rotating disk drive I would expect ``dd bs=100M ...` to be at least ten times faster than copying the data via a snapshot. Sep 30, 2017 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .