From c1608de0643115d098b66ee48525535148c13cfa Mon Sep 17 00:00:00 2001 From: Ryusuke Konishi Date: Mon, 22 Jul 2019 00:12:28 +0900 Subject: [PATCH] mkfs.nilfs2: fix wrong suggestion of minimum device size Even if we give "required size" that mkfs.nilfs2 suggests for too small devices, mkfs.nilfs2 fails due to the lack of consideration of the trailing super block: Error: too small device. device size=134217728 bytes, required size=134217728 bytes. Please enlarge the device, or shorten segments with -B option. This fixes the issue. Signed-off-by: Ryusuke Konishi --- sbin/mkfs/mkfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c index 52ccc364..1e484af3 100644 --- a/sbin/mkfs/mkfs.c +++ b/sbin/mkfs/mkfs.c @@ -509,7 +509,8 @@ static void init_disk_layout(struct nilfs_disk_info *di, int fd, " device size=%llu bytes, required size=%llu bytes.\n" " Please enlarge the device, or shorten segments with -B option.", dev_size, - (unsigned long long)segment_size * min_nsegments); + (unsigned long long)segment_size * min_nsegments + + blocksize); di->nseginfo = 0; }