LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-11-2020, 12:52 PM   #1
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,455
Blog Entries: 1

Rep: Reputation: 66
Question SOLVED: BTRFS how to find the volume which is the parent of sub-volumes


Hi there !

Code:
localhost:/home/miguel # btrfs subvolume list -t /var
ID      gen     top level       path
--      ---     ---------       ----
256     1993    5               @
257     1997    256             @/var
258     1964    256             @/usr/local
259     1997    256             @/tmp
260     1888    256             @/srv
261     1964    256             @/root
262     1905    256             @/opt
263     1888    256             @/boot/grub2/x86_64-efi
264     1888    256             @/boot/grub2/i386-pc
localhost:/home/miguel #
How do I know who is the parent dir (volume) of theses sub-volumes ?

I expect to see all theses sub-volumes as regular folders in the parent folder.

thank you in advance,

Last edited by marozsas; 05-13-2020 at 11:53 AM. Reason: mark it as solved
 
Old 05-12-2020, 06:34 AM   #2
shruggy
Member
 
Registered: Mar 2020
Posts: 925

Rep: Reputation: Disabled
Just guessing. Maybe
Code:
btrfs inspect-internal subvolid-resolve <ID> <MountPoint>
 
Old 05-12-2020, 09:55 AM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,455

Original Poster
Blog Entries: 1

Rep: Reputation: 66
Quote:
Originally Posted by shruggy View Post
Just guessing. Maybe
Code:
btrfs inspect-internal subvolid-resolve <ID> <MountPoint>
no, not useful really....
Code:
root@fenix:/home/miguel# btrfs inspect-internal subvolid 272 /home/miguel/tmp
miguel/tmp
root@fenix:/home/miguel#
 
Old 05-13-2020, 11:47 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,455

Original Poster
Blog Entries: 1

Rep: Reputation: 66
Thumbs up SOLVED

Code:
root@fenix:/home/miguel# btrfs filesystem show | awk '/ +uuid:/ {print $4}' | xargs -L 1 -I{} blkid -t  UUID={}
/dev/sdc2: LABEL="home-btrf" UUID="af3bd7fe-5796-4248-9917-3e71a5a56ec6" UUID_SUB="f1d4dae9-d68d-4dbf-8b35-7a789ec3d7f2" TYPE="btrfs" PARTLABEL="home" PARTUUID="63b012c8-4c9f-49f5-85d9-da7e0f6b4a23"
root@fenix:/home/miguel#
Looks like btrfs does not have a tool to inform which is the parent folder or root folder of sub-volume.
You have to figure out based on the UUID returned by "btrfs filesystem show" and using blkid, return the device that match that UUID.

I hope this could be useful to someone.

cheers,
 
Old 05-14-2020, 12:37 PM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 18.3+19.3, MX-18, Mandrake
Posts: 4,352

Rep: Reputation: Disabled
Thanks for coming back and sharing your solution .
 
  


Reply

Tags
btrfs, sub-volume


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
btrfs filesystem df /mnt/btrfs/ shows bothe data and metdata with raid1 and single. gonus Linux - Software 3 07-17-2014 02:48 PM
LXer: Rollback To A Working State With btrfs + apt-btrfs-snapshot On Ubuntu 12.10 LXer Syndicated Linux News 0 11-25-2012 10:42 AM
ext4 vs btrfs, and with btrfs do I still need to use LVM? blue_k Linux - Software 4 08-17-2012 11:31 PM
Shell Script to compare folders,Sub-Folders and Sub-Sub-Folders unix_72427 Programming 8 08-08-2012 02:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration