All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@gmail.com>
To: "kreijack@inwind.it" <kreijack@inwind.it>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>,
	cwillu <cwillu@cwillu.com>,
	"Martin Steigerwald" <Martin@lichtvoll.de>,
	"Chris Murphy" <lists@colorremedies.com>,
	"Michael Kjörling" <michael@kjorling.se>,
	"Hugo Mills" <hugo@carfax.org.uk>
Subject: [RFC][V2] New attempt to a better "btrfs fi df"
Date: Mon, 29 Oct 2012 23:21:19 +0100	[thread overview]
Message-ID: <508F015F.5090507@gmail.com> (raw)
In-Reply-To: <50899151.1070503@inwind.it>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

this is a new attempt to improve the output of the command "btrfs fi df".

The previous attempt received a good reception. However there was no a
general consensus about the wording.

Moreover I still didn't understand how btrfs was using the disks.
A my first attempt was to develop a new command which shows how the
disks are divided in chunks.
Then after some thoughts I made three commands:

$ btrfs filesystem df <path>
# btrfs device disk-usage <path>
# btrfs filesystem disk-usage <path>

The first one shows only the section that before I called "Summary":

$ ./btrfs filesystem df /mnt/btrfs1/
Disk_size:		  21.00GB
Disk_allocated:		   1.83GB
Disk_unallocated:	  19.17GB
Used:			 284.00KB
Free_(Estimated):	  15.76GB	(Max: 20.54GB, min: 10.96GB)
Data_to_disk_ratio:	     75 %

The second one show the chunk list grouped by devices:

$ sudo ./btrfs device disk-usage /mnt/btrfs1/
/dev/vdb	    3.00GB
   Data,Single:              8.00MB
   Data,RAID0:             307.25MB
   Metadata,Single:          8.00MB
   Metadata,RAID1:         460.94MB
   System,Single:            4.00MB
   Unallocated:              2.23GB

/dev/vdc	    3.00GB
   Data,RAID0:             307.25MB
   System,RAID1:             8.00MB
   Unallocated:              2.69GB

/dev/vdd	    3.00GB
   Data,RAID0:             307.25MB
   Metadata,RAID1:         460.94MB
   System,RAID1:             8.00MB
   Unallocated:              2.24GB

/dev/vdf	   12.00GB
   Unallocated:             12.00GB


The third one shows the devices grouped by chunk type; it has two kind
of output the first kind of output is a linear one (as before); the
second kind of output is in a tabular form. I don't like it because it
is suitable only when the filesystem uses few profile; otherwise this
output is larger than 80 columns.

$ sudo ./btrfs filesystem disk-usage /mnt/btrfs1/
Data,Single: Size:8.00MB, Used:0.00
   /dev/vdb	    8.00MB

Data,RAID0: Size:921.75MB, Used:256.00KB
   /dev/vdb	  307.25MB
   /dev/vdc	  307.25MB
   /dev/vdd	  307.25MB

Metadata,Single: Size:8.00MB, Used:0.00
   /dev/vdb	    8.00MB

Metadata,RAID1: Size:460.94MB, Used:24.00KB
   /dev/vdb	  460.94MB
   /dev/vdd	  460.94MB

System,Single: Size:4.00MB, Used:0.00
   /dev/vdb	    4.00MB

System,RAID1: Size:8.00MB, Used:4.00KB
   /dev/vdc	    8.00MB
   /dev/vdd	    8.00MB

Unallocated:
   /dev/vdb	    2.23GB
   /dev/vdc	    2.69GB
   /dev/vdd	    2.24GB
   /dev/vdf	   12.00GB



$ sudo ./btrfs filesystem disk-usage -t /mnt/btrfs1/
           Data      Data      Metadata  System    System
           Single    RAID0     Single    Single    RAID1     Unused

vdb          8.00MB  307.25MB    8.00MB    4.00MB         -    2.23GB
vdc               -  307.25MB         -         -    8.00MB    2.69GB
vdd               -  307.25MB         -         -    8.00MB    2.24GB
vdf               -         -         -         -         -   12.00GB
          ========= ========= ========= ========= ========= =========
Total        8.00MB  921.75MB    8.00MB    4.00MB    8.00MB   19.17GB
Used           0.00  256.00KB      0.00      0.00    4.00KB


The latest output is a fake, because the original one requires 78-79
columns, so the email reader would rewrap it. I had to remove a column
(Metadata,RAID1) : this confirm me that this kind of output is
unusable as general case.

The code is pullable from
        http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git
branch
        info-cmd

I don't publish the patches because aren't in a good shape. The
example is a filesystem based on three disks of 3GB and one disk of 12 GB.

Comments are welcome.

Known bugs:
- - the commands btrfs fi disk-usage and btrfs device disk-usage need
root capability (I use the BTRFS_IOC_TREE_SEARCH
to get the chunk info; so that is unavoidable)



- -- 
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQjwFeAAoJEA7amzeLguC1jtEP/1tzU9s2mfLhz1AVotYW3oWd
hnVNdBmz/E+uGJYTY99heB/Vmnu2dZUQyKlbUilAM7XtQw7GsEITGa+6peoPIPrI
8v0mYL+e/Bd24caMS7DlRR1cJ9lqWlJg6lxwGryVYCyYcFIkkRhw5PcFAxOyF2xe
Q0aESR8a4CA7NBMXH6QeTLD7oSZAnIFAK/EDYbExweJ1a+OSMzgJ+CMWmlaOf79v
R90c9qg309dUctHO0mB/D5XjJlFwNaGJpNsxEvBJdkZl0VgHxm1unsaxYLFU5ybk
/qJs7yqJIFk9BtV15zREtuC7n+CC5Mwo/gPOP24qyZazfLgMv72NaOTmDdiXuNpV
vjVgAgNSRL5JSI6RTQEgJwy2xgPJA/k0z4R20xpXRn0+E2OHDSKk/+gqmCE3Iieb
3LcJBuEPSQxpx6R5RubNhwauu3h6Dn4qBIUSagH6zYz+AUwkfcUTGdS3vgrXfEUf
UNGn3wEcz8veIr66cOm3t6pTcRInFOIvOf/32Bei1SZyEiiX0pzxmSWAutaOiRNe
m+sjWhFF3QW6wKX25QRXFgqnFJQwpx+9sP90dQvTh5oOio+xbi+eGZJ8WEMVY6b1
L4iiqY8DtnfufQF2XUGGIa8b8Wxdp15gUoeqPKh2Oy8srEsUjV+g4vwXOMrRtYfR
d4o8YssrtjlpSBQCYHpZ
=TUa5
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2012-10-29 22:20 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25 19:21 [RFC] New attempt to a better "btrfs fi df" Goffredo Baroncelli
2012-10-25 19:40 ` cwillu
2012-10-25 19:59   ` Goffredo Baroncelli
2012-10-25 20:06     ` cwillu
2012-10-25 20:36   ` Chris Murphy
2012-10-25 20:49     ` cwillu
2012-10-25 20:52       ` Goffredo Baroncelli
2012-10-25 20:03 ` Chris Murphy
2012-10-25 20:11   ` cwillu
2012-10-25 20:41     ` Goffredo Baroncelli
2012-10-26  2:33     ` Chris Murphy
2012-10-26  3:36       ` cwillu
2012-10-26  4:03         ` Chris Murphy
2012-10-27 15:05         ` Chris Murphy
2012-10-27 16:43 ` Martin Steigerwald
2012-10-27 19:55   ` Michael Kjörling
2012-10-27 22:30     ` Martin Steigerwald
2012-10-27 22:38       ` Hugo Mills
2012-10-27 23:01         ` Michael Kjörling
2012-10-28 10:58           ` Martin Steigerwald
2012-10-28  8:45         ` Goffredo Baroncelli
2012-10-28 10:38           ` Martin Steigerwald
2012-10-28 10:59             ` Goffredo Baroncelli
2012-10-28 11:18               ` Michael Kjörling
2012-10-28 12:25                 ` Goffredo Baroncelli
2012-10-28 12:48                   ` Michael Kjörling
2012-10-28 13:22                   ` Martin Steigerwald
2012-10-27 23:35     ` Chris Murphy
2012-10-28 11:20       ` Michael Kjörling
2012-10-28  9:01 ` Goffredo Baroncelli
2012-10-28 10:33   ` Martin Steigerwald
2012-10-28 10:58     ` Goffredo Baroncelli
2012-10-28 11:16       ` Martin Steigerwald
2012-10-28 18:27         ` Chris Murphy
2012-10-28 19:06           ` Michael Kjörling
2012-10-28 19:42             ` Chris Murphy
2012-10-28 20:09               ` Michael Kjörling
2012-10-28 20:19                 ` Chris Murphy
2012-10-29  9:04                   ` Michael Kjörling
2012-10-30  4:41                     ` Chris Murphy
2012-10-28 19:42             ` Chris Murphy
2012-10-29 13:06             ` Randy Barlow
2012-10-29 22:21 ` Goffredo Baroncelli [this message]
2012-10-30  9:42   ` [RFC][V2] " Michael Kjörling
2012-10-30 18:15     ` Goffredo Baroncelli
2012-10-30 18:32       ` Michael Kjörling
2012-10-30 20:13         ` Chris Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=508F015F.5090507@gmail.com \
    --to=kreijack@gmail.com \
    --cc=Martin@lichtvoll.de \
    --cc=cwillu@cwillu.com \
    --cc=hugo@carfax.org.uk \
    --cc=kreijack@inwind.it \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    --cc=michael@kjorling.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.