trynd / wren

Linux boot platform that provides a portable, multi-system, run-in-memory Linux environment.
GNU General Public License v3.0
0 stars 1 forks source link

Incorrect active data capacity at startup #22

Closed codewithmichael closed 9 years ago

codewithmichael commented 9 years ago

Addressed by PR #12.

Loading a Wren instance with a standard, nearly empty save file causes the active data capacity to start at 2 GB instead of the expected 1 GB (default).

As noted in PR #12, the problem occurs becauseinitramfs-script is using the getFileSize function (from platform-env) to determine the size of the save image. Since getFileSize doesn't take sparse image size into consideration, it's simply calling it 1 GB (the standard initial save file size).

Because the active data capacity is increased (by 1 GB default) if the save size gets within the default tolerance range of 512 MB, it is immediately expading from 1 GB to 2 GB.

The (non-technical) solution is to read the sparse file size instead of the reserved file size when determining save size in initramfs-script. There is already a function for this in platform-env called getDiskUsage.

codewithmichael commented 9 years ago

I have addressed this in PR #12 (Replace LVM with BTRFS).

Since there were no other calls in initramfs-script using the stat command (as is used in getFileSize), I removed the copy_exec for stat in initramfs-hooks and replaced it with a copy_exec for du (which is used by getDiskUsage.