loop back device with lvm
Less than 1 minute
loop back device with lvm
main usage
- virtualize a file as an image disk and added it into lvm
conceptions
- loop back device
- lvm
practise
pre-requirements
- you need to know basic conceptions
- logical volume manager has been read and practised
purpose
- virtualize a file as an image disk
- add image disk to lvm
- create LV to use the storage
do it
- prepare a virtual machine according to create centos 8 with qemu
- create an image file
dd if=/dev/zero of=disk.img bs=1M count=1024
- bind with loop back device
losetup /dev/loop0 disk.img
- create VG with loop back device
vgcreate vgtest /dev/loop0
- create LV
lvcreate -L 100M -n data vgtest
- create file system on LV
mkfs.xfs /dev/mapper/vgtest-data
- mount and test
mount /dev/mapper/vgtest-data /mnt df -h touch /mnt/test-file echo this is a part of testing > /mnt/test-file echo this is a another part of testing >> /mnt/test-file cat /mnt/test-file