Hi, I''m somewhat confused with who is right on what when it comes to showing disk usage and space free. I have a file system that I''m using for testing with a full linux installed as well as X and a desktop. I''ve created a good amount of snapshots and I''ve also done a lot of changes to the system throuhgout the process. I''ve run a balance before taking these meassurements: -> df -h reports 59G total space, 18G used, 7G free. -> btrfs fi df / reports the following: Data, RAID0: total=16.00GB, used=15.58GB System, RAID1: total=32.00MB, used=4.00KB System: total=4.00MB, used=0.00 Metadata, RAID1: total=6.00GB, used=974.36MB So from what I garther the df reports used space somewhat correctly. Is it true that my total disk usage should only be around 16.6G now? Does that include all space required to store the snapshots as well? I''d be pretty amazed at that number because I''ve changed A LOT between snapshots. Why is df reporting only 7G free? Wouldn''t it be possible to make it report the sum of total minus used instead which would be at least a lot closer to the truth? Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Mar 29, 2013 at 07:58:40AM -0600, Harald Glatt wrote:> Hi, > > I''m somewhat confused with who is right on what when it comes to > showing disk usage and space free. > > I have a file system that I''m using for testing with a full linux > installed as well as X and a desktop. I''ve created a good amount of > snapshots and I''ve also done a lot of changes to the system throuhgout > the process. > > I''ve run a balance before taking these meassurements: > > -> df -h reports 59G total space, 18G used, 7G free. > -> btrfs fi df / reports the following: > Data, RAID0: total=16.00GB, used=15.58GB > System, RAID1: total=32.00MB, used=4.00KB > System: total=4.00MB, used=0.00 > Metadata, RAID1: total=6.00GB, used=974.36MB > > So from what I garther the df reports used space somewhat correctly. > Is it true that my total disk usage should only be around 16.6G now? > Does that include all space required to store the snapshots as well? > I''d be pretty amazed at that number because I''ve changed A LOT between > snapshots. > > Why is df reporting only 7G free? Wouldn''t it be possible to make it > report the sum of total minus used instead which would be at least a > lot closer to the truth? >So you need to include btrfs fi show to get at why df -h reports what it reports. Basically df does this total = total bytes used = total data used * raid multiplier + total system used * raid multiplier + metadata used * raid multiplier avail (or free) = (data total - data used) + (total bytes - allocated) where allocated is the sum of all the data chunks * their raid multipliers. How many disks do you have in this array? Take whatever that number is and multiply it by the numbers for the RAID1 chunks and thats how much real space is used. Thanks, Josef -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Sorry I forgot to post that, -> btrfs fi show Label: none uuid: 2feccf06-5af8-4d8a-ad8d-a090cf4ef69a Total devices 2 FS bytes used 16.54GB devid 1 size 40.90GB used 14.04GB path /dev/sda7 devid 2 size 17.75GB used 14.03GB path /dev/sda6 The array is more of a for-fun and testing thing than a real world example. I''ve simply combined two differently sized partitions on the same disk together. So how much space is actually used now? On Fri, Mar 29, 2013 at 3:12 PM, Josef Bacik <jbacik@fusionio.com> wrote:> On Fri, Mar 29, 2013 at 07:58:40AM -0600, Harald Glatt wrote: >> Hi, >> >> I''m somewhat confused with who is right on what when it comes to >> showing disk usage and space free. >> >> I have a file system that I''m using for testing with a full linux >> installed as well as X and a desktop. I''ve created a good amount of >> snapshots and I''ve also done a lot of changes to the system throuhgout >> the process. >> >> I''ve run a balance before taking these meassurements: >> >> -> df -h reports 59G total space, 18G used, 7G free. >> -> btrfs fi df / reports the following: >> Data, RAID0: total=16.00GB, used=15.58GB >> System, RAID1: total=32.00MB, used=4.00KB >> System: total=4.00MB, used=0.00 >> Metadata, RAID1: total=6.00GB, used=974.36MB >> >> So from what I garther the df reports used space somewhat correctly. >> Is it true that my total disk usage should only be around 16.6G now? >> Does that include all space required to store the snapshots as well? >> I''d be pretty amazed at that number because I''ve changed A LOT between >> snapshots. >> >> Why is df reporting only 7G free? Wouldn''t it be possible to make it >> report the sum of total minus used instead which would be at least a >> lot closer to the truth? >> > > So you need to include btrfs fi show to get at why df -h reports what it > reports. Basically df does this > > total = total bytes > used = total data used * raid multiplier + total system used * raid multiplier + > metadata used * raid multiplier > avail (or free) = (data total - data used) + (total bytes - allocated) > > where allocated is the sum of all the data chunks * their raid multipliers. How > many disks do you have in this array? Take whatever that number is and multiply > it by the numbers for the RAID1 chunks and thats how much real space is used. > Thanks, > > Josef-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Mar 29, 2013 at 03:18:03PM +0100, Harald Glatt wrote:> Sorry I forgot to post that, > > -> btrfs fi show > Label: none uuid: 2feccf06-5af8-4d8a-ad8d-a090cf4ef69a > Total devices 2 FS bytes used 16.54GB > devid 1 size 40.90GB used 14.04GB path /dev/sda7 > devid 2 size 17.75GB used 14.03GB path /dev/sda6 > > The array is more of a for-fun and testing thing than a real world > example. I''ve simply combined two differently sized partitions on the > same disk together. > > So how much space is actually used now? > > On Fri, Mar 29, 2013 at 3:12 PM, Josef Bacik <jbacik@fusionio.com> wrote: > > On Fri, Mar 29, 2013 at 07:58:40AM -0600, Harald Glatt wrote: > >> I''ve run a balance before taking these meassurements: > >> > >> -> df -h reports 59G total space, 18G used, 7G free. > >> -> btrfs fi df / reports the following: > >> Data, RAID0: total=16.00GB, used=15.58GB > >> System, RAID1: total=32.00MB, used=4.00KB > >> System: total=4.00MB, used=0.00 > >> Metadata, RAID1: total=6.00GB, used=974.36MBOK, so you have 14.04+14.03 = 28.07 GiB allocated for immediate use on the disk. Of that 28.07 GiB, - 16.00 GiB is assigned for RAID-0, and 15.58 GiB of that is actually occupied by useful data. - 6.00*2 = 12.00 GiB is assigned for use by RAID-1 metadata, giving 6.00 GiB of usable metadata. 974.36 MiB of that contains actual metadata. - 68.00 MiB (2*32.00 + 4.00) is the remainder, assigned to the system chunks (actually the chunk tree), of which 4 KiB is actually useful data. Now, since you have RAID-0 data, the FS requires at least two devices to stripe across. So the best it can manage is to add a further 3.75 GiB of data chunks on each device (because /dev/sda6 has 3.75 GiB not allocated). 3.75 GiB on two deivces for RAID-0 is 2*3.75 = 7.5 GiB reported free by df. HTH, Hugo. -- === Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk == PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- Gentlemen! You can''t fight here! This is the War Room! ---
Ahhhhh, now it makes sense!! Thanks! On Fri, Mar 29, 2013 at 3:27 PM, Hugo Mills <hugo@carfax.org.uk> wrote:> On Fri, Mar 29, 2013 at 03:18:03PM +0100, Harald Glatt wrote: >> Sorry I forgot to post that, >> >> -> btrfs fi show >> Label: none uuid: 2feccf06-5af8-4d8a-ad8d-a090cf4ef69a >> Total devices 2 FS bytes used 16.54GB >> devid 1 size 40.90GB used 14.04GB path /dev/sda7 >> devid 2 size 17.75GB used 14.03GB path /dev/sda6 >> >> The array is more of a for-fun and testing thing than a real world >> example. I''ve simply combined two differently sized partitions on the >> same disk together. >> >> So how much space is actually used now? >> >> On Fri, Mar 29, 2013 at 3:12 PM, Josef Bacik <jbacik@fusionio.com> wrote: >> > On Fri, Mar 29, 2013 at 07:58:40AM -0600, Harald Glatt wrote: >> >> I''ve run a balance before taking these meassurements: >> >> >> >> -> df -h reports 59G total space, 18G used, 7G free. >> >> -> btrfs fi df / reports the following: >> >> Data, RAID0: total=16.00GB, used=15.58GB >> >> System, RAID1: total=32.00MB, used=4.00KB >> >> System: total=4.00MB, used=0.00 >> >> Metadata, RAID1: total=6.00GB, used=974.36MB > > OK, so you have 14.04+14.03 = 28.07 GiB allocated for immediate use > on the disk. > > Of that 28.07 GiB, > > - 16.00 GiB is assigned for RAID-0, and 15.58 GiB of that is actually > occupied by useful data. > > - 6.00*2 = 12.00 GiB is assigned for use by RAID-1 metadata, giving > 6.00 GiB of usable metadata. 974.36 MiB of that contains actual > metadata. > > - 68.00 MiB (2*32.00 + 4.00) is the remainder, assigned to the system > chunks (actually the chunk tree), of which 4 KiB is actually useful > data. > > Now, since you have RAID-0 data, the FS requires at least two > devices to stripe across. So the best it can manage is to add a > further 3.75 GiB of data chunks on each device (because /dev/sda6 has > 3.75 GiB not allocated). 3.75 GiB on two deivces for RAID-0 is 2*3.75 > = 7.5 GiB reported free by df. > > HTH, > Hugo. > > -- > === Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ==> PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk > --- Gentlemen! You can''t fight here! This is the War Room! ----- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html