<div dir="ltr"><div><div><div><div>Ecco qua la dimostrazione di quanto scritto sopra.<br></div>Ho fatto un thin-volume da 5G e ci ho scritto 2 file da 512M.<br></div>Poi ho cancellato uno dei file.<br></div>Ho paragonato il <b>mapped size</b> prima e dopo la rimozione e non è variato.<br></div>Ho poi eseguito fstrim e lo spazio si è liberato.<b><br></b><div><div><div><div><br>lvcreate -V5G -T pve/pve-thin -n test<br>  Using default stripesize 64,00 KiB.<br>  Logical volume "test" created.<br>mkfs.ext4 /dev/pve/test<br>mke2fs 1.43.4 (31-Jan-2017)<br>Discarding device blocks: fatto                           <br>Creazione del file system con 1310720 4k blocchi e 327680 inode<br>Etichetta del file system=c24a4410-dabe-4b98-bfdf-43777088cd55<br>Backup del superblocco salvati nei blocchi: <br>        32768, 98304, 163840, 229376, 294912, 819200, 884736<br><br>Allocating group tables: fatto                           <br>Scrittura delle tavole degli inode: fatto                           <br>Creating journal (16384 blocks): fatto<br>Scrittura delle informazioni dei super-blocchi e dell'accounting del file system: fatto<br><br>mkdir /mnt/test <br>mount /dev/pve/test /mnt/test<br>dd if=/dev/urandom of=/mnt/test/garbage1 bs=1M count=512<br>dd if=/dev/urandom of=/mnt/test/garbage2 bs=1M count=512<br><br>lvdisplay /dev/pve/test<br>  --- Logical volume ---<br>  LV Path                /dev/pve/test<br>  LV Name                test<br>  VG Name                pve<br>  LV UUID                HDvbtK-pQjQ-Izqw-KevC-obNE-100W-lU0D0e<br>  LV Write Access        read/write<br>  LV Creation host, time vmserver, 2017-07-04 12:26:12 +0200<br>  LV Pool name           pve-thin<br>  LV Status              available<br>  # open                 1<br>  LV Size                5,00 GiB<br>  Mapped size            22,89%<br>  Current LE             1280<br>  Segments               1<br>  Allocation             inherit<br>  Read ahead sectors     auto<br>  - currently set to     256<br>  Block device           253:9<br><br><br>rm /mnt/test/garbage2 <br><br>lvdisplay /dev/pve/test<br>  --- Logical volume ---<br>  LV Path                /dev/pve/test<br>  LV Name                test<br>  VG Name                pve<br>  LV UUID                HDvbtK-pQjQ-Izqw-KevC-obNE-100W-lU0D0e<br>  LV Write Access        read/write<br>  LV Creation host, time vmserver, 2017-07-04 12:26:12 +0200<br>  LV Pool name           pve-thin<br>  LV Status              available<br>  # open                 1<br>  LV Size                5,00 GiB<br><b>  Mapped size            22,89%</b><br>  Current LE             1280<br>  Segments               1<br>  Allocation             inherit<br>  Read ahead sectors     auto<br>  - currently set to     256<br>  Block device           253:9<br><br><br>fstrim /mnt/test<br><br>lvdisplay /dev/pve/test <br>  --- Logical volume ---<br>  LV Path                /dev/pve/test<br>  LV Name                test<br>  VG Name                pve<br>  LV UUID                HDvbtK-pQjQ-Izqw-KevC-obNE-100W-lU0D0e<br>  LV Write Access        read/write<br>  LV Creation host, time vmserver, 2017-07-04 12:26:12 +0200<br>  LV Pool name           pve-thin<br>  LV Status              available<br>  # open                 1<br>  LV Size                5,00 GiB<br><b>  Mapped size            12,89%</b><br>  Current LE             1280<br>  Segments               1<br>  Allocation             inherit<br>  Read ahead sectors     auto<br>  - currently set to     256<br>  Block device           253:9<br><br><br></div></div></div></div></div>