2. 2/29
Common problems
● Resize partition?
Use space on separated disks?
Use speed of multiple devices?
Write same data on more devices?
Backup used filesystem?
●
●
●
●
14. 12/29
Snapshot
● stores only differences
origin and snapshot, both are RW
snapshot != backup
100% full is lost completely
Use
●
●
●
●
● backup
fsck
test/rollback on production data “--merge”
virtual machines
●
●
●
lvcreate --size 100M --snapshot --name
18. 16/29
vg0-lv0_mlog
$ sudo dmsetup info
Name:
State:
Read Ahead:
ACTIV
E 256
Tables present:
Open count:
Event number:
LIV
E 1
0
Major, minor: 253, 0
Number of targets: 1
UUID: LVM-
ggZ5NqMTOZx43akuLZxxn03JdQGNta6gWlHnr0WT1Ua8Ek56ke6X9CdH8m3OVs
Ag
Name:
State:
Read Ahead:
Tables present:
Open count:
Event number:
Major, minor:
vg0-
lv0_mimage_1
ACTIVE
768
LIV
E 1
0
253, 2
Number of targets: 1
UUID: LVM-
ggZ5NqMTOZx43akuLZxxn03JdQGNta6gKIufDqbRgOaURN83IeA2AbYfH0zwTI0d
Name:
State:
Read Ahead:
Tables present:
Open count:
Event number:
Major, minor:
vg0-
lv0_mimage_0
ACTIVE
768
LIV
E 1
0
253, 1
Number of targets: 1
UUID: LVM-
ggZ5NqMTOZx43akuLZxxn03JdQGNta6g23mlbEbEk5r5l9Hy6YgRxuu2hd4DFg0Q
Name:
State:
Read Ahead:
Tables present:
Open count:
Event number:
vg0-lv0
ACTIV
E 256
LIVE
1
1
19. 19/29
How LVM Works:
LVM has basically three terms, Physical Volume PV, Volume
Group VG, Logical Volume LV.
PV – It’s a raw hard drive that it initialized to work with LVM, such
as /dev/sdb, /dev/sdc, /dev/sdb1 etc.
VG – Many PV is combined into one VG. You can create many VGs
and each of them has a unique name.
LV – You can create many LVs from a VG. You can extend, reduce
the LV size on the fly. The LV also has unique names. You format
the LV into ext4, zfs, btrfs etc filesystems, mount it and use it as
you do other ordinary partitions.
20. $ sudo pvcreate /dev/loop[0-6]
Physical volume "/dev/loop0" successfully created
Physical volume "/dev/loop1" successfully
Physical volume "/dev/loop2" successfully
Physical volume "/dev/loop3" successfully
Physical volume "/dev/loop4" successfully
Physical volume "/dev/loop5" successfully
Physical volume "/dev/loop6" successfully
created
created
created
created
created
created
$ sudo pvs
PV VG Fmt Attr PSize PFree
20/29
/dev/loop0 lvm2 a- 500,00m 500,00
m
/dev/loop1 lvm2 a- 500,00m 500,00
m
/dev/loop2 lvm2 a- 500,00m 500,00
m
/dev/loop3 lvm2 a- 500,00m 500,00
m
/dev/loop4 lvm2 a- 500,00m 500,00
m
/dev/loop5 lvm2 a- 500,00m 500,00
m
/dev/loop6 lvm2 a- 500,00m 500,00
m
$ sudo vgcreate vg0 /dev/loop[0-6]
Volume group "vg0" successfully created
$ sudo vgs
VG #PV #LV #SN Attr
VSize VFree vg0 7 0
21. vg
0
21/29
$ sudo vgdisplay
--- Volume group ---
VG Name
System ID
Format
Metadata Areas
Metadata Sequence
No VG Access
VG Status
MAX LV
Cur LV
Open
LV
Max PV
Cur PV
Act PV
VG Size
PE Size
Total PE
Alloc PE / Size
Free PE / Size
VG
UUID
lvm
2 7
22
read/write
resizable
0
0
0
0
7
7
3,39 GiB
4,00 MiB
868
0 / 0
868 / 3,39 GiB
ggZ5Nq-MTOZ-x43a-kuLZ-xxn0-3JdQ-
GNta6g
$ sudo lvcreate -i2 -m1 -L1200m -n lv0
vg
0 Using default stripesize 64,00 KiB Logical
volume "lv0" created