From 5f852979eef730bc31a79afca8df00e251c91a16 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Sat, 15 Mar 2025 21:56:27 +0300 Subject: [PATCH] ntfsprogs/mkntfs: improve error when creating NTFS on a plain file mkntfs is special among all other mkfs utilities in that it'd refuse to create an FS over a plain file (which is often needed for testing purposes). This might seem like an odd choice, but it has to do with how NTFS works, and the error is there to make sure things wouldn't go south for a user. However, it lacked the explanation what exactly may be wrong, not to mention it also didn't mention that FS could be created by passing `--force`. Fix that. Fixes: https://github.com/tuxera/ntfs-3g/issues/145 --- ntfsprogs/mkntfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 5c3a367b..5b60e818 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3503,7 +3503,11 @@ static BOOL mkntfs_open_partition(ntfs_volume *vol) } if (!S_ISBLK(sbuf.st_mode)) { - ntfs_log_error("%s is not a block device.\n", vol->dev->d_name); + ntfs_log_error("%s is not a block device.\n" + "You can force creation with `--force`, but note that such image " + "couldn't be transferred to the actual device because device and " + "NTFS sector sizes must match.\n" + , vol->dev->d_name); if (!opts.force) { ntfs_log_error("Refusing to make a filesystem here!\n"); goto done;