Tuesday, September 12, 2017

Setting up thin volume steps

Thin LVM creation steps:

# Creating Virtual disk(loop device) using testlvm file
dd if=/dev/zero of=/root/testlvm.img bs=1024 count=600000

# Link the file created to loop device
losetup /dev/loop1 /root/testlvm.img
    # this will find first free loop device to use and attach to the file.
losetup -f /root/testlvm.img

   To verify:
   losetup -a

#  Make disk as lvm disk
pvcreate /dev/loop1

Note: use #pvdisplay, #pvscan for physical volume information.

# Create volume group
vgcreate test_VG /dev/loop1

Note: - use vgs, vgdisplay for info .

#  Create a thin LV pool
lvcreate -L 500M -T test_VG/mythinpool

Note: #lvdisplay test_VG or #lvs test_VG for verify

#  Create thin logical volume (LV) out of  LV pool created
lvcreate -V1000M  -T test_VG/mythinpool -n thinvolume

Note: #lvdisplay test_VG or #lvs test_VG for verify.
Note, -V is virtual size and it is more than size mentioned above.

#  Format the LV
mkfs.ext4 /dev/test_VG/thinvolume

# Mount the LV
mount /dev/test_VG/thinvolume /mnt

man 7 lvmthin
man 8 lvm
man 8 losetup

No comments:

Post a Comment