Giter Club home page Giter Club logo

btrfs-list's People

Contributors

amc90 avatar speed47 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btrfs-list's Issues

Is it possible to add a path truncate option?

I have a path from docker: /var/lib/docker/btrfs/subvolumes/66281c586c95bc969e46ea749970d5d6f77a63a8c8fafec2580e5cc41486df34
That path is very large, because of that the table is not properly arranged in the terminal.

UUIDs not shown

UUIDs are not shown.

└> sudo btrfs filesystem show
Label: 'label'  uuid: bd56f0a1-b50b-49a3-846b-f3f9b6fbe5a3
        Total devices 1 FS bytes used 2.53TiB
        devid    1 size 3.64TiB used 2.57TiB path /dev/sdc

versus

└> sudo ./btrfs-list -q -a 
NAME      ID PARENT TOPLVL GEN CGEN       UUID PARENTUUID  RCVD_UUID                OTIME    TYPE     EXCL  MOUNTPOINT
label    -      -      -   -    -          -          -          -                    -      fs    2.53T (single/dup, 1.10T/3.64T free, 30.27%)
    [main]  5      -      -   -    -          -          -          -                    - mainvol       -  /media/user/label

Truncated names of subvolumes and/or snapshots containing spaces

> btrfs-list --version
btrfs-list v2.2 using btrfs v5.4.1

Having a snapshot and a subvolume containing spaces in its name.

CAMERA_BACKUP/@2023-07-02                                                                                   subvol       -  
CAMERA_BACKUP/.@2023-07-02                                                                                  rosnap       -  

Original was something like CAMERA_BACKUP/.@2023-07-02 Some description

After Restore of snapshot: No dependencies are shown

After I restored a snapshot the dependencies are not shown.

To reproduce the issue...
Generate a test volume and some snapshots

btrfs subvolume create test   # Create new subvolume
btrfs subvolume snapshot test test-backup  # Do a backup
btrfs subvolume snapshot test test-backup2   # Another backup

Show it with btrfs-list

btrfs-list /mnt/pro/ |grep -E 'NAME|single|test'
NAME                                          TYPE    REFER     EXCL  MOUNTPOINT
b04de56b                                        fs       -   374.04G (single, 546.00G free)
   test                                     subvol   16.00k   16.00k 
      test-backup                             snap   16.00k   16.00k 
      test-backup2                            snap   16.00k   16.00k 

If you now have to restore your test-backup2 you do

btrfs subvolume delete test
Delete subvolume (no-commit): '/mnt/pro/test'
btrfs subvolume snapshot test-backup2 test
Create a snapshot of 'test-backup2' in './test'

And after some days create a new backup
btrfs subvolume snapshot test test-backup-after-restore

Now btrfs-list didn't show dependencies ("test-backup-after-restore" should depend to "test")

btrfs-list /mnt/pro/ |grep -E 'NAME|single|test'
NAME                                          TYPE    REFER     EXCL  MOUNTPOINT
b04de56b                                        fs       -   374.04G (single, 546.00G free)
test-backup2                                  snap   16.00k   16.00k 
test                                          snap   16.00k   16.00k 
test-backup                                   snap   16.00k   16.00k 
test-backup-after-restore                     snap   16.00k   16.00k 

"test-backup-after-restore" is shown as snapshot with normal btrfs tool:

btrfs subvolume show test
test
        Name:                   test
        UUID:                   8db29b7d-5331-7742-af40-92b65eb22884
        Parent UUID:            57fadfee-483f-0b42-9229-c68bf12ddabc
        Received UUID:          -
        Creation time:          2022-01-02 10:41:07 +0100
        Subvolume ID:           474
        Generation:             87841
        Gen at creation:        87834
        Parent ID:              5
        Top level ID:           5
        Flags:                  -
        Send transid:           0
        Send time:              2022-01-02 10:41:07 +0100
        Receive transid:        0
        Receive time:           -
        Snapshot(s):
                                test-backup-after-restore
        Quota group:            0/474
          Limit referenced:     -
          Limit exclusive:      -
          Usage referenced:     16.00KiB
          Usage exclusive:      16.00KiB

Version info warning

When I run command
# ./btrfs-list
it prints warning message

WARNING: your kernel seems older (v4.13.x) than the btrfs-progs userspace tool (v4.4), some features might not be supported.
NAME      ID     TYPE     REFER      USED
backup     -       fs         -   650.80M (5.45G free)

I wrote simple patch

diff --git a/btrfs-list b/btrfs-list
index 09b4100..900e191 100755
--- a/btrfs-list
+++ b/btrfs-list
@@ -1,6 +1,7 @@
 #! /usr/bin/perl -T
 use strict;
 use warnings;
+use version;
 use IPC::Open3;
 use Symbol 'gensym';
 use Getopt::Long;
@@ -123,7 +124,7 @@ if ($version lt '3.16')
 @cmd = run_cmd( { can_fail => 0 }, qw{ uname -r } );
 my ($kerver) = $cmd[1][0] =~ /^(\d+\.\d+)/;
 my ($shortversion) = $version =~ /^(\d+\.\d+)/;
-if ($kerver lt $shortversion)
+if (version->declare($kerver)->numify lt version->declare($shortversion)->numify)
 {
        print STDERR "WARNING: your kernel seems older (v$kerver.x) than the btrfs-progs userspace tool (v$version), some features might not be supported.\n";
 }

alignment broken

indented snaps last 4 columns are not aligned correctly 2 spaces offset

NAME                          TYPE    REFER     EXCL  MOUNTPOINT
dalivgdab9                      fs       -     4.87G (raid1, 818.28G/825.18G free, 99.16%)
    [main]                 mainvol   16.00k   16.00k /vgd
    adm                     subvol   32.00k   16.00k
        snaps/adm-2023-02-11  rosnap   32.00k   16.00k
    iso                     subvol    2.69G   16.00k
        snaps/iso-2023-02-11  rosnap    2.69G   16.00k
    jail/don                subvol    2.29G    2.29G
    snaps/jail-2023-02-11   rosnap   16.00k   16.00k

btrfs-list

Automatically request root permissions

Could you add functionality to make the script automatically ask for root permissions when it is not run as root?
Because it requires it to function properly/at all...

  • Fe. instead of the well-know sudo you could be using pkexec which automatically generates Popup when run under a GUI?
    (pkexec is the PolicyKit's version of sudo) 😉

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.