Bug 94911 - Wrong size of device unallocated and wrong size of free (estimated): 8EiB or 16EiB
Summary: Wrong size of device unallocated and wrong size of free (estimated): 8EiB or ...
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-16 15:01 UTC by raffix
Modified: 2015-03-17 16:05 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.16.0
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description raffix 2015-03-16 15:01:03 UTC
btrfs-tools version is 3.18.2

I have two 1.5TB drives in a RAID1 configuration.

sudo btrfs fi df /home
Data, RAID1: total=972.00GiB, used=962.17GiB
System, RAID1: total=32.00MiB, used=176.00KiB
Metadata, RAID1: total=3.00GiB, used=1.18GiB
GlobalReserve, single: total=416.00MiB, used=0.00B

For testing purposes I switched off one of them and mounted the left one in degraded mode:

sudo btrfs fi sh /home
Label: none  uuid: 6f5413f9-c99c-499c-b6ed-2440cb5acd2f
	Total devices 2 FS bytes used 963.33GiB
	devid    1 size 1.36TiB used 975.03GiB path /dev/sdb1
	*** Some devices missing

However, the command: "btrfs fi us /home" shows a complete wrong result. The entry "Device unallocated" says 16.00EiB (Exbibyte !!).
I can assure you, I have only one 1.5TB device. ;-)

sudo btrfs fi us /home
Overall:
    Device size:		   1.36TiB
    Device allocated:		   1.90TiB
    Device unallocated:		  16.00EiB    <--- WRONG!!
    Used:			   1.88TiB
    Free (estimated):		   8.00EiB	(min: 8.00EiB)   <--- WRONG!!
    Data ratio:			      2.00
    Metadata ratio:		      2.00
    Global reserve:		 416.00MiB	(used: 0.00B)

Data,RAID1: Size:972.00GiB, Used:962.15GiB
   	 972.00GiB
   /dev/sdb1	 972.00GiB

Metadata,RAID1: Size:3.00GiB, Used:1.18GiB
   	   3.00GiB
   /dev/sdb1	   3.00GiB

System,RAID1: Size:32.00MiB, Used:176.00KiB
   	  32.00MiB
   /dev/sdb1	  32.00MiB

Unallocated:
   	 422.23GiB
   /dev/sdb1	 422.23GiB
Comment 1 David Sterba 2015-03-17 10:17:58 UTC
8.00EiB is a result of interpretting a negative signed 64bit number as unsigned. The negative number is probably caused by wrong calculations, in your case probably due to the degraded mount.
Comment 2 David Sterba 2015-03-17 13:38:15 UTC
Reproduced and fix will be sent to mailinglist.
Comment 3 raffix 2015-03-17 16:05:33 UTC
Thank you very much for your work!

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