All of lore.kernel.org
 help / color / mirror / Atom feed
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: Chris Murphy <lists@colorremedies.com>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: RFE: btrfs subvolume list -t, include marker for snapshots, and whether they are ro
Date: Fri, 15 Apr 2016 15:51:32 +0900	[thread overview]
Message-ID: <57108F74.3050802@jp.fujitsu.com> (raw)
In-Reply-To: <CAJCQCtSUj0fcsH7AUREnm7KzdDZiL2pW9MpSkKiQBcV9-J9nXQ@mail.gmail.com>

On 2016/04/15 10:55, Chris Murphy wrote:
> Hi,
>
> I'm realizing instead of doing 'btrfs subvolume -t' and then 'btrfs
> subvolume -tr' and comparing, it would be better if -t just had a
> column for whether a subvolume is ro. And maybe it's useful to know if
> a subvolume is a snapshot or not (?). I'm not super picky about the
> last one. But being able to see if it's ro or not is a nice to have.
>
> In particular on openSUSE with snapper where there's a prolific amount
> of snapshots, and the naming convention doesn't indicate whether
> something is ro or not.
>

Although I'm not sure whether such changes is acceptable or not,
just FYI, you can list subvols with ro flags by the following script.

================================================================
#!/bin/ruby

IO.popen("btrfs sub list -t " + ARGV[0]) {|p_list|
   puts p_list.gets.chomp + "ro"
   puts p_list.gets.chomp + "--"
   ro = ''
   p_list.each { |l|
     l.chomp!
     path = l.split[3]
     IO.popen("btrfs property get #{ARGV[0]+path} | sed -nre 's/^ro=(true|false)$/\\1/p'") { |p_prop|
       ro = p_prop.gets
       ro = "false" if ro.nil?
     }

     puts l + "\t" + ro
   }
}
================================================================

# NOTE: It's not well tested.

sample output:
================================================================
# ./sub-list-with-ro.rb /
ID      gen     top level       path    ro
--      ---     ---------       ----    --
257     48672   5               root    false
259     48623   257             var/lib/machines        false
452     36540   257             root/snaps/root-2016-03-18      true
457     45676   257             root/snaps/root-2016-04-08      true
================================================================

Thanks,
Satoru

  reply	other threads:[~2016-04-15  6:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  1:55 RFE: btrfs subvolume list -t, include marker for snapshots, and whether they are ro Chris Murphy
2016-04-15  6:51 ` Satoru Takeuchi [this message]
2016-04-15  6:57   ` Chris Murphy
2016-04-15 11:18 ` Austin S. Hemmelgarn

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=57108F74.3050802@jp.fujitsu.com \
    --to=takeuchi_satoru@jp.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    /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.