linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [btrfs-progs] Bug in mkfs.btrfs -r
@ 2017-08-31 17:27 Goffredo Baroncelli
  2017-08-31 18:49 ` Austin S. Hemmelgarn
  2017-09-01  0:13 ` Qu Wenruo
  0 siblings, 2 replies; 15+ messages in thread
From: Goffredo Baroncelli @ 2017-08-31 17:27 UTC (permalink / raw)
  To: linux-btrfs

Hi All,


I found a bug in mkfs.btrfs, when it is used the option '-r'. It seems that it is not visible the full disk.

$ uname -a
Linux venice.bhome 4.12.8 #268 SMP Thu Aug 17 09:03:26 CEST 2017 x86_64 GNU/Linux
$ btrfs --version
btrfs-progs v4.12


--- First try without '-r' (/dev/sda is about 80GB)

$ sudo mkfs.btrfs  -f /dev/sda4
btrfs-progs v4.12
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               6f11971d-a945-4f33-8750-c16a7438a15d
Node size:          16384
Sector size:        4096
Filesystem size:    83.73GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP               1.00GiB
  System:           DUP               8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1    83.73GiB  /dev/sda4


All the disk (~80GB) is visible


---- Now try with '-r'

$ sudo mkfs.btrfs  -r /tmp/test/ -f /dev/sda4
btrfs-progs v4.12
See http://btrfs.wiki.kernel.org for more information.

Making image is completed.
Label:              (null)
UUID:               60ea1c38-e5b1-403d-8a25-1cac2258922d
Node size:          16384
Sector size:        4096
Filesystem size:    52.00MiB
Block group profiles:
  Data:             single           29.19MiB
  Metadata:         DUP               5.19MiB
  System:           DUP               4.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1    52.00MiB  /dev/sda4


where /tmp/test contains:
$ ls -l /tmp/test/
total 16392
-rw-r--r-- 1 ghigo ghigo        5 Aug 31 18:26 123
-rw-r--r-- 1 ghigo ghigo 16777216 Aug 31 18:26 123456
-rw-r--r-- 1 ghigo ghigo        5 Aug 31 18:26 456


BTRFS sees only 52MB instead of ~80GB.

Even if I try to mount and umount, the thing doesn't change.

$ sudo mount /dev/sda4 /mnt/other/
$ echo 123 | sudo tee /mnt/other/9999
123
$ sync
$ sudo umount /mnt/other 
$ sudo mount /dev/sda4 /mnt/other/

Below an output of "btrfs fi us"

$ sudo btrfs fi us /mnt/other/
Overall:
    Device size:		  52.00MiB
    Device allocated:		  52.00MiB
    Device unallocated:		     0.00B
    Device missing:		     0.00B
    Used:			  16.16MiB
    Free (estimated):		  13.19MiB	(min: 13.19MiB)
    Data ratio:			      1.00
    Metadata ratio:		      1.00
    Global reserve:		  16.00MiB	(used: 0.00B)

Data,single: Size:29.19MiB, Used:16.00MiB
   /dev/sda4	  29.19MiB

Metadata,single: Size:18.81MiB, Used:144.00KiB
   /dev/sda4	  18.81MiB

System,single: Size:4.00MiB, Used:16.00KiB
   /dev/sda4	   4.00MiB

Unallocated:
   /dev/sda4	     0.00B



And a balance is impossible

$ sudo btrfs bala start --full-balance /mnt/other/
ERROR: error during balancing '/mnt/other/': No space left on device
There may be more info in syslog - try dmesg | tail

$ dmesg | tail
[ 2034.684649] BTRFS: device fsid 60ea1c38-e5b1-403d-8a25-1cac2258922d devid 1 transid 7 /dev/sda4
[ 2140.835629] BTRFS info (device sda4): disk space caching is enabled
[ 2140.835632] BTRFS info (device sda4): has skinny extents
[ 2140.835633] BTRFS info (device sda4): flagging fs with big metadata feature
[ 2140.837381] BTRFS info (device sda4): creating UUID tree
[ 2171.646349] BTRFS info (device sda4): disk space caching is enabled
[ 2171.646362] BTRFS info (device sda4): has skinny extents
[ 2273.696914] BTRFS info (device sda4): relocating block group 20512768 flags data
[ 2273.721995] BTRFS info (device sda4): relocating block group 9633792 flags data
[ 2273.746950] BTRFS info (device sda4): 6 enospc errors during balance


I tried several btrfs-progs version ( I go back until v0.20-rc1: 2012!!!), and the behavior is the same: with '-r' the disk is not fully used. So I suppose that it is a kernel problem (IIRC the kernel should "complete" the mkfs at the first mount). Any idea ? 

BR
G.Baroncelli

-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-09-05  3:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-31 17:27 [btrfs-progs] Bug in mkfs.btrfs -r Goffredo Baroncelli
2017-08-31 18:49 ` Austin S. Hemmelgarn
2017-08-31 20:29   ` Goffredo Baroncelli
2017-09-01 11:49     ` Austin S. Hemmelgarn
2017-09-01  0:13 ` Qu Wenruo
2017-09-01 11:28   ` Austin S. Hemmelgarn
2017-09-01 11:49     ` Qu Wenruo
2017-09-01 12:05       ` Austin S. Hemmelgarn
2017-09-01 12:19         ` Qu Wenruo
2017-09-01 12:47           ` Austin S. Hemmelgarn
2017-09-01 13:54             ` Qu Wenruo
2017-09-01 14:07               ` Austin S. Hemmelgarn
2017-09-02  4:03                 ` Duncan
2017-09-05  3:57                   ` Duncan
2017-09-01 11:54     ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).