Bug 112461 - mkfs minimum device size behavior is confusing
Summary: mkfs minimum device size behavior is confusing
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-14 21:49 UTC by Chris Murphy
Modified: 2016-03-20 09:50 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.5.0-0.rc3.git0.1.fc24.x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Chris Murphy 2016-02-14 21:49:56 UTC
This seems broken in more than one way. It says the minimum size is "41943040" but what are the units? If these are bytes, it should format a 40MiB device, but this fails with defaults. In fact it fails on 99MiB device, but succeeds on a 100M device, so the actual minimum appears to be 100MiB using mkfs defaults. If so, it should just say that and include the units so this isn't ambiguous.

[root@f23m ~]# fallocate -l 32M 32M.img
[root@f23m ~]# mkfs.btrfs 32M.img 
btrfs-progs v4.4
See http://btrfs.wiki.kernel.org for more information.

'32M.img' is too small to make a usable filesystem
Minimum size for each btrfs device is 41943040.

[root@f23m ~]# fallocate -l 99M 99M.img
[root@f23m ~]# mkfs.btrfs 99M.img 
btrfs-progs v4.4
See http://btrfs.wiki.kernel.org for more information.

not enough free space
[root@f23m ~]# fallocate -l 100M 100M.img
[root@f23m ~]# mkfs.btrfs 100M.img 
btrfs-progs v4.4
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               64b89e4a-8a46-4782-bda7-eb28679c0681
Node size:          16384
Sector size:        4096
Filesystem size:    100.00MiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP              40.00MiB
  System:           DUP              12.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1   100.00MiB  100M.img

===================

If I add the -M switch, the minimum is different. It's even less than 40MiB.

[root@f23m ~]# fallocate -l 16M 16M.img
[root@f23m ~]# mkfs.btrfs -M 16M.img 
btrfs-progs v4.4
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               dd8d22ca-0fa2-4635-a78c-3ec0165d24b6
Node size:          4096
Sector size:        4096
Filesystem size:    16.00MiB
Block group profiles:
  Data+Metadata:    single            1.56MiB
  System:           single            4.00MiB
SSD detected:       no
Incompat features:  mixed-bg, extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1    16.00MiB  16M.img


Since it clearly depends on things like sector size, nodesize, data and metadata profile, it should base the minimum device size on the current command line values (plus whatever is autodiscovered, i.e. sector size, single vs DUP). And it should also report back the value's units.

Note You need to log in before you can comment on or make changes to this bug.