Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I created an LVM snapshot, then I modified the original logical volume, and now I see that I probably allocated too much space to hold the snapshot. And I want to reclaim some free space by reducing the space allocated for the snapshot.

How can I check how much the space allocated for a snapshot can be reduced without breaking the snapshot?

In other words: How to find out the space actually needed at the current moment for a snapshot to continue to exist?

(If I know this minimal necessary size, then I probably can simply use lvreduce to reclaim more free space for the VG from the snapshot.)

share|improve this question

1 Answer 1

Actually, the space that is in actual use by the snapshot can be easily seen after activating the volumes (e.g., with vgchange -a y) -- in percents of the total space allocated for the snapshot:

it is shown in the Allocated to snapshot row of the output of lvdisplay, or by the snap_percent option of lvs.

(I simply was examining the volumes without activating them -- that's why I couldn't see this info straight on.)

If, for example, it's 5%, then you can simply use lvreduce -l 5%LV (or a bit more) to recalim all the unused space from the snapshot volume.

share|improve this answer
    
When calling lvdisplay /path/to/snapshot, two of my three LVM snapshots don't report the Allocated to snapshot line. Does this mean these snapshots have exhausted their allocated free space and have therefore become useless? –  Abdull Jan 10 at 18:32
    
@Abdull I don't know. You'd better ask a new question. And give a link to it here please. –  imz -- Ivan Zakharyaschev Jan 11 at 1:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.