linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* determining filesystem mount points
@ 2012-12-29  5:04 Russell Coker
  2012-12-29  9:36 ` Bart Noordervliet
  0 siblings, 1 reply; 4+ messages in thread
From: Russell Coker @ 2012-12-29  5:04 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org list

What's a good way of determining the mount point for a BTRFS filesystem in a 
shell script?

/home/user might be a filesystem, a directory under a filesystem /home, a 
directory under a subvol /home of /, a subvol of /, or a subvol of the /home 
filesystem.  How do I determine which it is?

-- 
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/

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

* Re: determining filesystem mount points
  2012-12-29  5:04 determining filesystem mount points Russell Coker
@ 2012-12-29  9:36 ` Bart Noordervliet
  2012-12-30  1:23   ` Russell Coker
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Noordervliet @ 2012-12-29  9:36 UTC (permalink / raw)
  To: russell+btrfs; +Cc: linux-btrfs@vger.kernel.org list

Hi Russell,

all of the information you need should be available from the 'mount'
and 'btrfs subvol list' commands. Though I realise it can be awkward
to parse it out of there, this will be the only way to get accurate
information in the face of bind-mounts and other fancy tricks. One
other datapoint that you might be able to use is that btrfs, I
believe, always shows inode number 256 for subvolumes in 'stat'. Keep
in mind there that the root subvolume is, as the name implies, also
technically a subvolume.

Regards, Bart

On Sat, Dec 29, 2012 at 6:04 AM, Russell Coker
<russell+btrfs@coker.com.au> wrote:
> What's a good way of determining the mount point for a BTRFS filesystem in a
> shell script?
>
> /home/user might be a filesystem, a directory under a filesystem /home, a
> directory under a subvol /home of /, a subvol of /, or a subvol of the /home
> filesystem.  How do I determine which it is?
>
> --
> My Main Blog         http://etbe.coker.com.au/
> My Documents Blog    http://doc.coker.com.au/
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: determining filesystem mount points
  2012-12-29  9:36 ` Bart Noordervliet
@ 2012-12-30  1:23   ` Russell Coker
  2012-12-31  3:30     ` Anand Jain
  0 siblings, 1 reply; 4+ messages in thread
From: Russell Coker @ 2012-12-30  1:23 UTC (permalink / raw)
  To: Bart Noordervliet; +Cc: linux-btrfs@vger.kernel.org list

On Sat, 29 Dec 2012, Bart Noordervliet <bart@noordervliet.net> wrote:
> all of the information you need should be available from the 'mount'
> and 'btrfs subvol list' commands. Though I realise it can be awkward
> to parse it out of there, this will be the only way to get accurate
> information in the face of bind-mounts and other fancy tricks. One
> other datapoint that you might be able to use is that btrfs, I
> believe, always shows inode number 256 for subvolumes in 'stat'. Keep
> in mind there that the root subvolume is, as the name implies, also
> technically a subvolume.

What I want to do is to have shell scripts create snapshots and then 
automatically remove them.  As the output of "btrfs subvol list" is relative 
to the root of the filesystem even if we don't consider bind mounts and other 
complications it becomes difficult to generate a "btrfs subvol delete" command 
that is correct from a shell script.

Perhaps the best solution would be to have an option to "btrfs subvol list" to 
give output with fully qualified paths.

-- 
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/

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

* Re: determining filesystem mount points
  2012-12-30  1:23   ` Russell Coker
@ 2012-12-31  3:30     ` Anand Jain
  0 siblings, 0 replies; 4+ messages in thread
From: Anand Jain @ 2012-12-31  3:30 UTC (permalink / raw)
  To: russell+btrfs; +Cc: Bart Noordervliet, linux-btrfs@vger.kernel.org list



> Perhaps the best solution would be to have an option to "btrfs subvol list" to
> give output with fully qualified paths.

  This patch does that.

    http://comments.gmane.org/gmane.comp.file-systems.btrfs/20040


-Anand


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

end of thread, other threads:[~2012-12-31  3:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-29  5:04 determining filesystem mount points Russell Coker
2012-12-29  9:36 ` Bart Noordervliet
2012-12-30  1:23   ` Russell Coker
2012-12-31  3:30     ` Anand Jain

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).