26.9.2017
fallocate - preallocate space to a file
losetup - set up and control loop devices
pvs - Display information about physical volumes
pvcreate - Initialize physical volume(s) for use by LVM
pvremove - Remove LVM label(s) from physical volume(s)
vgs - Display information about volume groups
vgcreate - Create a volume group
vgremove - Remove volume group(s)
vgextend - Add physical volumes to a volume group
lvs - Display information about logical volumes
lvcreate - Create a logical volume
lvremove - Remove logical volume(s) from the system
- Create a loopback device with 100MiB
fallocate -l 100MiB filename
losetup -f filename
- Create GPT on that device with 5 small partitions
$
- Copy MBR partition table (*)
partitions 1,3,5 from GPT version should be visible MBR/GPT have to be supported mostly on dual/triple boot systems - it is not a preferred setup
$
- Create a physical volume on loopback device
fallocate -l 100M filename0
losetup -f filename0
pvcreate /dev/loop0
- Create a filesystem which fill 100% of LV
vgcreate vgA /dev/loop0
lvcreate --name lvA -l 100%FREE vgA
mkfs.ext4 /dev/vgA/lvA
-
Do not unmount filesystem in next steps
-
Create new physical volume
fallocate -l 100M filename1
losetup -f filename1
pvcreate /dev/loop1
- Extend volume group to use also this free space
vgextend vgA /dev/loop1
- Remove the first loopback device from systems
# CHECK IT ! Propably not correct.
losetup -d /dev/loop0
- Create 200MB thin pool
fallocate -l 250MiB filename0
losetup -f filename0
pvcreate /dev/loop0
vgcreate vgA /dev/loop0
lvcreate -l 200MiB --thinpool tpA vgA
- How large filesystem it can handle?
Thin pool volume with chunk size 64.00 KiB can address at most 15.81 TiB of data.
- Remove all thin volumes
# ???
- Create 2x thin volumes per 100MB
lvcreate -L 100MB --thinpool tpA1 vgA
lvcreate -L 100MB --thinpool tpA2 vgA
- Create a snapshot of thin volume
#ERROR (
# Using default stripesize 64.00 KiB.
# Please specify either size or extents with snapshots.
# )
lvcreate --name snapA1 --snapshot vgA/tpA1
- Create a snapshot of the snapshot
$
- Merge snapshot of snapshot to original thin volume
$