<div dir="ltr"><div><div><div><div>Zdenek,<br></div> Thanks. Here I am just filling it up with random data and so I am not concerned about data integrity<br></div> You are right, I did get page lost during write errors in the kernel <br><br></div>The question however is even after reboot and doing several fsck of the ext4fs the file size "occupied" is more than the pool size. How is this ? <br></div>I agree that data may be corrupted, but there *is* some data and this must be saved somewhere. Why is this "somewhere" exceeding the pool size ? <br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 4:33 PM, Zdenek Kabelac <span dir="ltr"><<a href="mailto:zkabelac@redhat.com" target="_blank">zkabelac@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 27.4.2016 14:33, Bhasker C V wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
  I am starting with investigating about the lvm thin provisioning<br>
  (repeat post from <a href="https://lists.debian.org/debian-user/2016/04/msg00852.html" rel="noreferrer" target="_blank">https://lists.debian.org/debian-user/2016/04/msg00852.html</a> )<br>
  (apologies for html mail)<br>
<br>
  I have done the following<br>
<br>
1.Create a PV<br>
vdb    252:16   0   10G  0 disk<br>
├─vdb1 252:17   0  100M  0 part<br>
└─vdb2 252:18   0  9.9G  0 part<br>
root@vmm-deb:~# pvcreate /dev/vdb1<br>
   Physical volume "/dev/vdb1" successfully created.<br>
root@vmm-deb:~# pvs<br>
   PV         VG   Fmt  Attr PSize   PFree<br>
   /dev/vdb1       lvm2 ---  100.00m 100.00m<br>
<br>
2. create a VG<br>
root@vmm-deb:~# vgcreate virtp /dev/vdb1<br>
   Volume group "virtp" successfully created<br>
root@vmm-deb:~# vgs<br>
   VG    #PV #LV #SN Attr   VSize  VFree<br>
   virtp   1   0   0 wz--n- 96.00m 96.00m<br>
<br>
3. create a lv pool  and a over-provisioned volume inside it<br>
root@vmm-deb:~# lvcreate -n virtpool -T virtp/virtpool -L40M<br>
   Logical volume "virtpool" created.<br>
root@vmm-deb:~# lvs<br>
   LV       VG    Attr       LSize  Pool Origin Data%  Meta%  Move Log<br>
Cpy%Sync Convert<br>
   virtpool virtp twi-a-tz-- 40.00m             0.00   0.88<br>
root@vmm-deb:~# lvcreate  -V1G -T virtp/virtpool -n vol01<br>
   WARNING: Sum of all thin volume sizes (1.00 GiB) exceeds the size of thin<br>
pool virtp/virtpool and the size of whole volume group (96.00 MiB)!<br>
   For thin pool auto extension activation/thin_pool_autoextend_threshold<br>
should be below 100.<br>
   Logical volume "vol01" created.<br>
root@vmm-deb:~# lvs<br>
   LV       VG    Attr       LSize  Pool     Origin Data%  Meta%  Move Log<br>
Cpy%Sync Convert<br>
   virtpool virtp twi-aotz-- 40.00m                 0.00   0.98<br>
   vol01    virtp Vwi-a-tz--  1.00g virtpool        0.00<br>
<br>
---------- Now the operations<br>
# dd if=/dev/urandom of=./fil status=progress<br>
90532864 bytes (91 MB, 86 MiB) copied, 6.00005 s, 15.1 MB/s^C<br>
188706+0 records in<br>
188705+0 records out<br>
96616960 bytes (97 MB, 92 MiB) copied, 6.42704 s, 15.0 MB/s<br>
<br>
# df -h .<br>
Filesystem               Size  Used Avail Use% Mounted on<br>
/dev/mapper/virtp-vol01  976M   95M  815M  11% /tmp/x<br>
# sync<br>
# cd ..<br>
root@vmm-deb:/tmp# umount x<br>
root@vmm-deb:/tmp# fsck.ext4 -f -C0  /dev/virtp/vol01<br>
e2fsck 1.43-WIP (15-Mar-2016)<br>
Pass 1: Checking inodes, blocks, and sizes<br>
Pass 2: Checking directory structure<br>
Pass 3: Checking directory connectivity<br>
Pass 4: Checking reference counts<br>
Pass 5: Checking group summary information<br>
/dev/virtp/vol01: 12/65536 files (8.3% non-contiguous), 36544/262144 blocks<br>
<br>
<mount><br>
# du -hs fil<br>
93M    fil<br>
<br>
# dd if=./fil of=/dev/null status=progress<br>
188705+0 records in<br>
188705+0 records out<br>
96616960 bytes (97 MB, 92 MiB) copied, 0.149194 s, 648 MB/s<br>
<br>
<br>
# vgs<br>
   VG    #PV #LV #SN Attr   VSize  VFree<br>
   virtp   1   2   0 wz--n- 96.00m 48.00m<br>
<br>
Definetly the file is occupying 90+MB.<br>
<br>
What i expect is that the pool is 40M and the file must NOT exceed 40M. Where<br>
does the file get 93M space ?<br>
I know the VG is 96M but the pool created was max 40M (also VG still says 48M<br>
free). Is the file exceeding the boundaries ?<br>
or am I doing anything wrong ?<br>
<br>
</blockquote>
<br>
<br></div></div>
Hi<br>
<br>
Answer is simple ->  nowhere - they are simply lost - check your kernel dmesg log - you will spot lost of async write error.<br>
(page cache is tricky here...    - dd ends just in page-cache which is later asynchronously sync to disk)<br>
<br>
There is also 60s delay before thin-pool target starts to error all queued write operations if there is not enough space in pool.<br>
<br>
So whenever you write something and you want to be 100% 'sure' it landed on disk you have to 'sync'  your writes.<br>
<br>
i.e.<br>
dd if=/dev/urandom of=./fil status=progress  conf=fsync<br>
<br>
and if you want to know 'exactly' what's the error place -<br>
<br>
dd if=/dev/urandom of=./fil status=progress oflags=direct<br>
<br>
Regards<br>
<br>
Zdenek<br>
<br>
_______________________________________________<br>
linux-lvm mailing list<br>
<a href="mailto:linux-lvm@redhat.com" target="_blank">linux-lvm@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/linux-lvm" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/linux-lvm</a><br>
read the LVM HOW-TO at <a href="http://tldp.org/HOWTO/LVM-HOWTO/" rel="noreferrer" target="_blank">http://tldp.org/HOWTO/LVM-HOWTO/</a></blockquote></div><br></div>