Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lvm snapshot test - does a snapshot ever take more space than the LV?
- test 1 - snapshot same size as volume
- create lv
- fill it up
- snapshot it
- delete files
- fill again
- delete files
- fill again
- etc. until it overflows. Watch the size.
- lvcreate -L 500MB -n test testvg
- mkfs.ext4 /dev/testvg/test
- mount /dev/testvg/test /mnt/test
- cp -a ~/archive/software/ubuntu/ test
- df test
- Filesystem 1K-blocks Used Available Use% Mounted on
- /dev/mapper/testvg-test 487652 487652 0 100% /mnt/test
- lvcreate --snapshot testvg/test -L 800MB -n testsnap /dev/sda4
- lvs
- LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
- test testvg owi-aos-- 500.00m
- testsnap testvg swi-a-s-- 500.00m test 0.00
- lvscan
- ACTIVE Original '/dev/testvg/test' [500.00 MiB] inherit
- ACTIVE Snapshot '/dev/testvg/testsnap' [500.00 MiB] inherit
- rm -r test/ubuntu/
- cp -a ~/archive/software/openSUSE/ test/
- df test
- Filesystem 1K-blocks Used Available Use% Mounted on
- /dev/mapper/testvg-test 487652 487652 0 100% /mnt/test
- lvdisplay
- --- Logical volume ---
- LV Path /dev/testvg/testsnap
- LV Name testsnap
- VG Name testvg
- LV UUID PmGbQ9-ggC1-ev92-zOW4-xNsu-XpH8-hdPSSD
- LV Write Access read/write
- LV Creation host, time peter, 2013-06-13 10:27:47 +0200
- LV snapshot status active destination for test
- LV Status available
- # open 0
- LV Size 500.00 MiB
- Current LE 125
- COW-table size 500.00 MiB
- COW-table LE 125
- Allocated to snapshot 95.22%
- Snapshot chunk size 4.00 KiB
- Segments 1
- Allocation inherit
- Read ahead sectors auto
- - currently set to 1024
- Block device 253:1
- rm -r test/openSUSE/
- lvdisplay
- --- Logical volume ---
- LV Path /dev/testvg/testsnap
- LV Name testsnap
- VG Name testvg
- LV UUID PmGbQ9-ggC1-ev92-zOW4-xNsu-XpH8-hdPSSD
- LV Write Access read/write
- LV Creation host, time peter, 2013-06-13 10:27:47 +0200
- LV snapshot status active destination for test
- LV Status available
- # open 0
- LV Size 500.00 MiB
- Current LE 125
- COW-table size 500.00 MiB
- COW-table LE 125
- Allocated to snapshot 95.24%
- Snapshot chunk size 4.00 KiB
- Segments 1
- Allocation inherit
- Read ahead sectors auto
- - currently set to 1024
- Block device 253:1
- cp -a ~/archive/software/FreeBSD/ test
- lvdisplay
- --- Logical volume ---
- LV Path /dev/testvg/testsnap
- LV Name testsnap
- VG Name testvg
- LV UUID PmGbQ9-ggC1-ev92-zOW4-xNsu-XpH8-hdPSSD
- LV Write Access read/write
- LV Creation host, time peter, 2013-06-13 10:27:47 +0200
- LV snapshot status active destination for test
- LV Status available
- # open 0
- LV Size 500.00 MiB
- Current LE 125
- COW-table size 500.00 MiB
- COW-table LE 125
- Allocated to snapshot 95.32%
- Snapshot chunk size 4.00 KiB
- Segments 1
- Allocation inherit
- Read ahead sectors auto
- - currently set to 1024
- Block device 253:1
- umount test
- dd if=/dev/zero of=/dev/testvg/test bs=4M
- lvdisplay
- /dev/testvg/testsnap: read failed after 0 of 4096 at 524222464: Input/output error
- /dev/testvg/testsnap: read failed after 0 of 4096 at 524279808: Input/output error
- /dev/testvg/testsnap: read failed after 0 of 4096 at 0: Input/output error
- /dev/testvg/testsnap: read failed after 0 of 4096 at 4096: Input/output error
- mount /dev/testvg/testsnap test2
- mount: /dev/mapper/testvg-testsnap: can't read superblock
- so in conclusion, it is *difficult* to overflow it, but with dd on the source volume, it destroys the snapshot. So I still wouldn't trust this.
- test 2 - snapshot larger than volume
- mkfs.ext4 /dev/testvg/test
- mount /dev/testvg/test /mnt/test
- cp -a ~/archive/software/ubuntu/ test
- lvremove testvg/testsnap
- lvcreate --snapshot testvg/test -L 800MB -n testsnap /dev/sda4
- lvs
- LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
- test testvg owi-aos-- 500.00m
- testsnap testvg swi-a-s-- 800.00m test 0.00
- mount /dev/testvg/testsnap /mnt/test2
- ls test2
- lost+found ubuntu
- umount test
- dd if=/dev/zero of=/dev/testvg/test bs=4M
- lvs
- LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
- test testvg owi-a-s-- 500.00m
- testsnap testvg swi-aos-- 800.00m test 62.75
- ls test2
- lost+found ubuntu
- lvdisplay
- --- Logical volume ---
- LV Path /dev/testvg/testsnap
- LV Name testsnap
- VG Name testvg
- LV UUID 5f8tXe-lIR9-aGcv-N2Z7-t6mL-UykX-J483zC
- LV Write Access read/write
- LV Creation host, time peter, 2013-06-13 10:34:56 +0200
- LV snapshot status active destination for test
- LV Status available
- # open 1
- LV Size 500.00 MiB
- Current LE 125
- COW-table size 800.00 MiB
- COW-table LE 200
- Allocated to snapshot 62.75%
- Snapshot chunk size 4.00 KiB
- Segments 1
- Allocation inherit
- Read ahead sectors auto
- - currently set to 1024
- Block device 253:1
- in conclusion: this seems to work fine. So there is probably some overhead that needs to be included when calculating the snapshot size to be more likely that it can be 'long lived'
Advertisement
Add Comment
Please, Sign In to add comment