All of lore.kernel.org
 help / color / mirror / Atom feed
* RFE: btrfs subvolume list -t, include marker for snapshots, and whether they are ro
@ 2016-04-15  1:55 Chris Murphy
  2016-04-15  6:51 ` Satoru Takeuchi
  2016-04-15 11:18 ` Austin S. Hemmelgarn
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Murphy @ 2016-04-15  1:55 UTC (permalink / raw)
  To: Btrfs BTRFS

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.

-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFE: btrfs subvolume list -t, include marker for snapshots, and whether they are ro
  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
  2016-04-15  6:57   ` Chris Murphy
  2016-04-15 11:18 ` Austin S. Hemmelgarn
  1 sibling, 1 reply; 4+ messages in thread
From: Satoru Takeuchi @ 2016-04-15  6:51 UTC (permalink / raw)
  To: Chris Murphy, Btrfs BTRFS

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFE: btrfs subvolume list -t, include marker for snapshots, and whether they are ro
  2016-04-15  6:51 ` Satoru Takeuchi
@ 2016-04-15  6:57   ` Chris Murphy
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Murphy @ 2016-04-15  6:57 UTC (permalink / raw)
  To: Btrfs BTRFS

On Fri, Apr 15, 2016 at 12:51 AM, Satoru Takeuchi
<takeuchi_satoru@jp.fujitsu.com> wrote:

> 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
> ================================================================


Yeah it's a good start. I'm not sure what the UI should be exactly.
Maybe it could be an ro column that's blank for rw and ro if it's ro.
Something that's easy to parse visually? Also have it line up in a
straight column, probably before the path column?

-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFE: btrfs subvolume list -t, include marker for snapshots, and whether they are ro
  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
@ 2016-04-15 11:18 ` Austin S. Hemmelgarn
  1 sibling, 0 replies; 4+ messages in thread
From: Austin S. Hemmelgarn @ 2016-04-15 11:18 UTC (permalink / raw)
  To: Chris Murphy, Btrfs BTRFS

On 2016-04-14 21: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.
If you're just wanting info about one subvolume, just use 'subvol show'. 
  As far as 'subvol list', that was mentioned in discussion on github of 
future changes for btrfs-progs (although I don't think that's gone 
anywhere).

Checking if something is a snapshot is easy though, do 'btrfs subvolume 
show -qt', if the Parent UUID column is a -, it's a regular subvolume, 
if not, it was created as a snapshot.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-15 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-04-15  6:57   ` Chris Murphy
2016-04-15 11:18 ` Austin S. Hemmelgarn

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.