From: Goffredo Baroncelli <kreijack@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: "Hugo Mills" <hugo@carfax.org.uk>,
"Michael Kjörling" <michael@kjorling.se>,
"Martin Steigerwald" <Martin@lichtvoll.de>,
cwillu <cwillu@cwillu.com>,
"Chris Murphy" <lists@colorremedies.com>
Subject: [PATCH][BTRFS-PROGS] Enhance btrfs fi df
Date: Fri, 2 Nov 2012 11:15:31 +0100 [thread overview]
Message-ID: <1351851339-19150-1-git-send-email-kreijack@inwind.it> (raw)
Hi all, on the basis of the discussion in the thread
'[RFC] New attempt to a better "btrfs fi df"', I prepared the following
set of patches.
These patches update the btrfs fi df command and add two new commands:
- btrfs filesystem disk-usage <path>
- btrfs device disk-usage <path>
The command "btrfs filesystem df" now shows only the disk usage/available.
$ btrfs filesystem df /mnt/btrfs1/
Disk size: 109.00GB
Disk allocated: 5.90GB
Disk unallocated: 103.10GB
Used: 284.00KB
Free (Estimated): 63.00GB (Max: 106.51GB, min: 54.96GB)
Data to disk ratio: 58 %
This was the "Summary" section of the my first attempt to enhance this
command.
The "Free (Estimated)" try to give an estimation of the free space
on the basis of the chunks usage.
The other two commands show the relation between the chunks and the disks.
$ 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:2.45GB, Used:24.00KB
/dev/vdb 1.45GB
/dev/vdc 1.00GB
/dev/vdd 460.94MB
/dev/vdi 2.00GB
System,Single: Size:4.00MB, Used:0.00
/dev/vdb 4.00MB
System,RAID1: Size:40.00MB, Used:4.00KB
/dev/vdc 40.00MB
/dev/vdd 40.00MB
Unallocated:
/dev/vdb 1.23GB
/dev/vdc 1.66GB
/dev/vdd 2.21GB
/dev/vdi 98.00GB
or in tabular format
$ sudo ./btrfs filesystem disk-usage -t /mnt/btrfs1/
Data Data Metadata Metadata System System
Single RAID0 Single RAID1 Single RAID1 Unallocated
/dev/vdb 8.00MB 307.25MB 8.00MB 1.45GB 4.00MB - 1.23GB
/dev/vdc - 307.25MB - 1.00GB - 40.00MB 1.66GB
/dev/vdd - 307.25MB - 460.94MB - 40.00MB 2.21GB
/dev/vdi - - - 2.00GB - - 98.00GB
====== ======== ======== ======== ====== ======= ===========
Total 8.00MB 921.75MB 8.00MB 2.45GB 4.00MB 40.00MB 103.10GB
Used 0.00 256.00KB 0.00 24.00KB 0.00 4.00KB
These are the most complete output, where it is possible to know which
disk a chunk uses and the usage of every chunk.
Finally the last command show which chunks a disk hosts:
$ 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: 1.45GB
System,Single: 4.00MB
Unallocated: 1.23GB
/dev/vdc 3.00GB
Data,RAID0: 307.25MB
Metadata,RAID1: 1.00GB
System,RAID1: 40.00MB
Unallocated: 1.66GB
/dev/vdd 3.00GB
Data,RAID0: 307.25MB
Metadata,RAID1: 460.94MB
System,RAID1: 40.00MB
Unallocated: 2.21GB
/dev/vdi 100.00GB
Metadata,RAID1: 2.00GB
Unallocated: 98.00GB
More or less are the same information above, only grouped by disk.
Unfortunately I don't have any information on the chunk usage per disk basis.
Comments are welcome.
The code is pullable from
http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git
branch
info-cmd
--
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
next reply other threads:[~2012-11-02 10:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 10:15 Goffredo Baroncelli [this message]
2012-11-02 10:15 ` [PATCH 1/8] Enhance the command btrfs filesystem df Goffredo Baroncelli
2012-11-02 10:15 ` [PATCH 2/8] Create the man page entry for the command btrfs fi df Goffredo Baroncelli
2012-11-02 10:15 ` [PATCH 3/8] Move open_file_or_dir() in utils.c Goffredo Baroncelli
2012-11-02 10:15 ` [PATCH 4/8] Move scrub_fs_info() and scrub_dev_info() " Goffredo Baroncelli
2012-11-02 10:15 ` [PATCH 5/8] Add command btrfs filesystem disk-usage Goffredo Baroncelli
2012-11-02 10:15 ` [PATCH 6/8] Create entry in man page for " Goffredo Baroncelli
2012-11-02 10:15 ` [PATCH 7/8] Add btrfs device disk-usage command Goffredo Baroncelli
2012-11-02 10:15 ` [PATCH 8/8] Create a new entry in btrfs man page for btrfs device disk-usage Goffredo Baroncelli
2012-11-02 11:18 ` [PATCH][BTRFS-PROGS] Enhance btrfs fi df Martin Steigerwald
2012-11-02 12:02 ` Goffredo Baroncelli
2012-11-02 19:05 ` Gabriel
2012-11-02 19:31 ` Goffredo Baroncelli
2012-11-02 20:40 ` Gabriel
2012-11-02 21:46 ` Michael Kjörling
2012-11-02 23:34 ` Gabriel
2012-11-02 22:06 ` Hugo Mills
2012-11-02 23:23 ` Gabriel
2012-11-02 23:44 ` Hugo Mills
2012-11-03 0:14 ` Gabriel
2012-11-03 12:28 ` Goffredo Baroncelli
2012-11-03 12:35 ` Goffredo Baroncelli
2012-11-03 22:04 ` cwillu
2012-11-03 12:11 ` Goffredo Baroncelli
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=1351851339-19150-1-git-send-email-kreijack@inwind.it \
--to=kreijack@gmail.com \
--cc=Martin@lichtvoll.de \
--cc=cwillu@cwillu.com \
--cc=hugo@carfax.org.uk \
--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 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).