Create Snapshot volume, with sized based on size of original lv
Hi.
I'd like to create a snapshot volume of eg. /dev/sys/Bilder and call it /dev/sys/Bilder_snap. Bilder_snap should be 25% the size of Bilder.
How would I do that?
In lvcreate --help, I find:
$ lvm lvcreate --help
[...]
lvcreate -s|--snapshot
[...]
{-l|--extents LogicalExtentsNumber[%{VG|LV|PVS|FREE}] |
-L|--size LogicalVolumeSize[kKmMgGtTpPeE]}
[...]$ lvm version WARNING: Running as a non-root user. Functionality may be unavailable. LVM version: 2.02.36 (2008-04-29) Library version: 1.02.24 (2007-12-20) /dev/mapper/control: open failed: Keine Berechtigung Failure to communicate with kernel device-mapper driver.
Based on the --help output, I tried:
$ sudo lvm lvcreate -s -l 25%LV -n Bilder_snap /dev/sys/Bilder Please express size as %VG, %PVS, or %FREE.
Did I do something wrong, or is the output "--help" just wrong?
Thanks a lot,
Michael
Signature · 1 line
Psssst! Schon vom neuen GMX MultiMessenger geh�rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
Quoted 4 lines · Michael Schmarck
$ sudo lvm lvcreate -s -l 25%LV -n Bilder_snap /dev/sys/Bilder Please express size as %VG, %PVS, or %FREE. Did I do something wrong, or is the output "--help" just wrong?
%LV is for resizing an existing LV.
lvcreate -s -l n%LV would indeed be unambiguous,
but what then about lvresize on a snapshot? Would it be % of base LV or % of existing snapshot? (Perhaps we need %ORIGIN.)
Alasdair
Signature · 1 line
[email protected]
Hi!
2008/10/6 Alasdair G Kergon <[email protected]>
Quoted 8 lines · Michael Schmarck
Quoted 4 lines
$ sudo lvm lvcreate -s -l 25%LV -n Bilder_snap /dev/sys/Bilder Please express size as %VG, %PVS, or %FREE. Did I do something wrong, or is the output "--help" just wrong?%LV is for resizing an existing LV.
All right; but why is it shown in the output of lvcreate --help in the "-s" section? It's not as if %<whatever> is shown in every output
of "-l" (eg. in the normal/first section of lvcreate, in the "-l" list, no % options are shown).
Quoted 1 line
lvcreate -s -l n%LV would indeed be unambiguous,
Yep.
Quoted 2 lines
but what then about lvresize on a snapshot? Would it be % of base LV or % of existing snapshot?
Hm. What happens, if you do a "lvcreate -s -l 42%VGS" and then make the VG larger? Do you then make the snapshot volume larger as well? Or what, if you'd use 8%FREE and then change the free space - do you make the snap lv larger and smaller as required?
Anyway: I'd expect the size of the snap lv to *NOT* change. Reason: The snap LV has been created with a certain size. Why should changes in the setup of the VG change the size of the snap lv? The size of a (snap) LV is something which I expect to be static (unless I, the admin of the system, change it). It should not at all be dynamic (although dynamic volumes are kinda cool, as can be seen in the case of ZFS - but that's a totally different approach and thus not comparable to LVM).
Quoted 1 line
(Perhaps we need %ORIGIN.)
Maybe. But that would IMO only make sense, if you currently change the sizes of snap LVs dynamically in the case of the other % options. If that's not done, then adding yet another option there would not be such a great idea, IMO. Instead, %LV should be used - for the reasons, please see above *g*.
Best regards,
Mike