Late to the party but this seems to be a known bug with Lineage OS. Users from another forum seem to have a solution:
this is due to BoardConfig.mk making the filesystem the full size of the block device. In place encryption requires 16KiB of free space at the end of the block dev.
This seems correct: I was able to encrypt successfully after resizing /data down by 16KiB. Explicit steps I took in TWRP:
Unmount /data
Open a terminal
e2fsck -f /dev/block/mmcblk0p25
resize2fs /dev/block/mmcblk0p25 6233084
Reboot, go through encryption process again.
(I can't post links, but if you google the issue you can find the link there)
Does anyone know what the commands are to resize the /data partition on the Moto G 2014?
Made some progress trying to resize the data partition, here are the steps I used:
First, boot into TWRP recovery and connect USB cable (I'm assuming you already have adb working on your PC).
Then, open up a command terminal (e.g. PowerShell) and type:
this lets you run terminal commands on your phone using the PC, then type
Code:
ls -l /dev/block/platform/msm_sdcc.1/by-name/userdata
this gives you the name of the data block, in my case it is /dev/block/mmcblk0p38
Next, you need to calculate the size of your data block, I used
Code:
blockdev --getsize64 /dev/block/mmcblk0p38
which returns the size in bytes, divide that number by 1024 to get the size in KiB. In my case I got 5774208 KiB
In theory, once you calculate the block size, you can then use
Code:
e2fsck -y -f /dev/block/mmcblk0p38
and
Code:
resize2fs /dev/block/mmcblk0p38 5774204
to change the size of your data partition
However, I'm stuck because e2fsck and resize2fs cannot read the file system (the file system for /data is tempfs instead of ext2).
Does anyone know why /data is using tempfs instead of ext? I'm only trying to resize the /data partition, no idea why this is so difficult.