Commit Graph

10 Commits (master)

Author SHA1 Message Date
David Sterba ca210687f8 btrfs-progs: fi usage: print ratio of used/total for each chunk type
This is based on idea from Stanislaw Gruszka to print the ratio,
originally suggested for the 'fi df', but we don't want to add new
things there and let people use 'fi us' instead. The new output fits
there and is printed by default without options:

Example output:

  $ btrfs fi us /mnt
  [...]

  Data,single: Size:339.00GiB, Used:172.05GiB (50.75%)

  Metadata,single: Size:7.00GiB, Used:3.41GiB (48.70%)

  System,single: Size:32.00MiB, Used:64.00KiB (0.20%)

Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:09:52 +01:00
David Sterba 1f5094bb5c btrfs-progs: add support for raid1c3 and raid1c4
Add support for 3- and 4- copy variants of RAID1. This adds resiliency
against 2 or resp. 3 devices lost or damaged.

$ ./mkfs.btrfs -m raid1c4 -d raid1c3 /dev/sd[abcd]

Label:              (null)
UUID:               f1f988ab-6750-4bc2-957b-98a4ebe98631
Node size:          16384
Sector size:        4096
Filesystem size:    8.00GiB
Block group profiles:
  Data:             RAID1C3         273.06MiB
  Metadata:         RAID1C4         204.75MiB
  System:           RAID1C4           8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata, raid1c34
Number of devices:  4
Devices:
   ID        SIZE  PATH
    1     2.00GiB  /dev/sda
    2     2.00GiB  /dev/sdb
    3     2.00GiB  /dev/sdc
    4     2.00GiB  /dev/sdd

Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:09:50 +01:00
David Sterba cbe239bf71 btrfs-progs: fi usage: sort table by device id
The result of 'btrfs fi usate -T' looks strange when the devices are
sorted by path and not by id. It's harder to lookup and the device id
reflects "the order of appearance" in the filesystem.

Original output:
              Data      Metadata  System
Id Path       RAID0     RAID1     RAID1    Unallocated
-- ---------- --------- --------- -------- -----------
 6 /dev/loop0 204.75MiB         -        -     1.80GiB
 3 /dev/loop1 204.75MiB         -        -     1.80GiB
 8 /dev/loop2 204.75MiB 256.00MiB  8.00MiB     1.54GiB
 1 /dev/loop3 204.75MiB         -        -     1.80GiB
 5 /dev/loop4 204.75MiB         -        -     1.80GiB
 4 /dev/loop5 204.75MiB         -        -     1.80GiB
 2 /dev/loop6 204.75MiB         -        -     1.80GiB
 7 /dev/loop7 204.75MiB 256.00MiB  8.00MiB     1.54GiB
-- ---------- --------- --------- -------- -----------
   Total        1.60GiB 256.00MiB  8.00MiB    13.88GiB
   Used           0.00B 112.00KiB 16.00KiB

New output:

              Data      Metadata  System
Id Path       RAID0     RAID1     RAID1    Unallocated
-- ---------- --------- --------- -------- -----------
 1 /dev/loop3 204.75MiB         -        -     1.80GiB
 2 /dev/loop6 204.75MiB         -        -     1.80GiB
 3 /dev/loop1 204.75MiB         -        -     1.80GiB
 4 /dev/loop5 204.75MiB         -        -     1.80GiB
 5 /dev/loop4 204.75MiB         -        -     1.80GiB
 6 /dev/loop0 204.75MiB         -        -     1.80GiB
 7 /dev/loop7 204.75MiB 256.00MiB  8.00MiB     1.54GiB
 8 /dev/loop2 204.75MiB 256.00MiB  8.00MiB     1.54GiB
-- ---------- --------- --------- -------- -----------
   Total        1.60GiB 256.00MiB  8.00MiB    13.88GiB
   Used           0.00B 112.00KiB 16.00KiB

Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:07:21 +01:00
David Sterba ccbea0977b btrfs-progs: utils: split device handling functions to own file
Helpers that read size, do zeoring, trim or prepare/finalize the device.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-04 02:06:34 +02:00
David Sterba add5079974 btrfs-progs: fix helpinfo formats, short and options separation
For options that do not have the long description, the empty string is
required to mark where the options start. Some commands were missing
that.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
David Sterba c07960c8be btrfs-progs: move utils.[ch] to common/
Update include paths and remove some duplicates.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
David Sterba 408cec5086 btrfs-progs: move string-table.[ch] to common/
Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:03 +02:00
David Sterba aac564aca6 btrfs-progs: move commonh to common/
Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:03 +02:00
David Sterba f93b471143 btrfs-progs: move help.[ch] to common/
Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:03 +02:00
David Sterba 4f398726d3 btrfs-progs: move all cmds-fi*.c to cmds/
This is the filesystem command group.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:03 +02:00