Hi,
I have a file system with 4K block size on a 32K page size platform, and
something strange happened when expanding the file system from size 17TB to
20TB. It seems that the new file system size is not calculated correctly.
$ resize2fs /dev/mapper/dev
resize2fs 1.43.3 (04-Sep-2016)
Filesystem at /dev/mapper/dev is mounted on /share/DATA; on-line
resizing required
resize2fs: On-line shrinking not supported
After digging into the issue, I find that the following operation makes the
high 32bit of the new_size variable be wiped out and results in a smaller
size compared to the currently used block counts. Here's the patch:
diff --git a/resize/main.c b/resize/main.c
index 5a99483..396391b 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -505,7 +505,7 @@ int main (int argc, char ** argv)
new_size = max_size;
/* Round down to an even multiple of a pagesize */
if (sys_page_size > blocksize)
- new_size &= ~((sys_page_size / blocksize)-1);
+ new_size &= ~((blk64_t)((sys_page_size / blocksize)-1));
}
/* If changing 64bit, don't change the filesystem size. */
if (flags & (RESIZE_DISABLE_64BIT | RESIZE_ENABLE_64BIT)) {
Thanks!
- Jerry
On Fri, Sep 09, 2016 at 07:36:06PM +0800, Jerry Lee wrote:
>
> I have a file system with 4K block size on a 32K page size platform, and
> something strange happened when expanding the file system from size 17TB to
> 20TB. It seems that the new file system size is not calculated correctly.
>
> $ resize2fs /dev/mapper/dev
> resize2fs 1.43.3 (04-Sep-2016)
> Filesystem at /dev/mapper/dev is mounted on /share/DATA; on-line
> resizing required
> resize2fs: On-line shrinking not supported
>
> After digging into the issue, I find that the following operation makes the
> high 32bit of the new_size variable be wiped out and results in a smaller
> size compared to the currently used block counts.
Thanks for the report; I've applied your suggested fix.
- Ted