Apparently, ntfs.mkfs counts one byte less when checking if the block device is large enough; or I have made some kind of mistake.
After creating a partition of 2048 512-byte sectors (exactly 1MiB total) on a GPT disk image file, I tried to make an NTFS filesystem on that partition. I ran
losetup my_image.img -f --show --offset $((2048 * 512)) # 2048 is the offset of the partiton
mkfs.ntfs /dev/loop0
. But mkfs.ntfs gave the following text:
The partition start sector was not specified for /dev/loop0 and it could not be obtained automatically. It has been set to 0. The number of sectors per track was not specified for /dev/loop0 and it could not be obtained automatically. It has been set to 0. The number of heads was not specified for /dev/loop0 and it could not be obtained automatically. It has been set to 0. Device is too small (1023kiB). Minimum NTFS volume size is 1MiB.
Basically counts one byte less than it should. And it is not a problem with the disk partitioning, as there can be no 1 byte error there. I know that this is not the proper way to do this, but I am more interested to know why this happens or what I am doing wrong. p.s. I also resized the partition explicitly to 1MiB in fdisk, so the problem isn't there.