Bug 743118

Summary: Mount doesn't display BTRFS subvolume option
Product: [Fedora] Fedora Reporter: Xavier Krantz <xakraz>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 15CC: jonathan, kdudka, kzak, ovasik
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-03 22:40:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Xavier Krantz 2011-10-03 21:33:14 UTC
Description of problem:
-----------------------
* Unlike Debian's version, "mount" doesn't show the "subvolume" option used when mounting a BTRFS subvolume. 

Version-Release number of selected component (if applicable):
--------------------------------------------------------------
* mount from util-linux 2.19.1 (with libblkid and selinux support)

How reproducible:
-----------------
* When typing "mount" as a normal user or Root, I'm waiting for the list of all mounted filesystem with their options. However, the "subvol" option of a subvolume is not showed.

Steps to Reproduce:
-------------------
1. Have a BTRFS Root partition
2. Install the system, home and other in separated subvolumes
3. Assign mount point using FSTAB
3. Type "mount" to list mount point and options
  
Actual results:
------------------
[ root@Jumper ] /home/xakraz
└─> # mount | grep btrfs
/dev/sda3 on / type btrfs (rw,noatime,seclabel,ssd,space_cache,clear_cache)
/dev/sda3 on /home type btrfs (rw,relatime,seclabel,ssd,space_cache,clear_cache)
/dev/sda3 on /tmp type btrfs (rw,noatime,seclabel,ssd,space_cache,clear_cache)
/dev/sda3 on /var/tmp type btrfs (rw,noatime,seclabel,ssd,space_cache,clear_cache)
/dev/sda3 on /home type btrfs (rw,relatime,seclabel,ssd,space_cache,clear_cache)


Expected results:
-----------------
/dev/sda3 on / type btrfs (rw,subvol=@,noatime,seclabel,ssd,space_cache,clear_cache)
/dev/sda3 on /home type btrfs (rw,subvol=@home,relatime,seclabel,ssd,space_cache,clear_cache)
....


Additional info:
-----------------
┌[ root@Jumper ] /
└─> # btrfs subvolume list /
ID 256 top level 5 path @
ID 257 top level 5 path @home

/etc/fstab
UUID=aa22fa92-6502-4401-8702-5a7f56978ab8 /               btrfs   defaults,ssd,space_cache,clear_cache,noatime,subvol=@ 0       1
UUID=aa22fa92-6502-4401-8702-5a7f56978ab8 /home           btrfs   defaults,ssd,space_cache,clear_cache,subvol=@home 0       2

Comment 1 Kamil Dudka 2011-10-03 21:52:51 UTC
(In reply to comment #0)
> Version-Release number of selected component (if applicable):
> --------------------------------------------------------------
> * mount from util-linux 2.19.1 (with libblkid and selinux support)

I am switching the component to util-linux.

Comment 2 Karel Zak 2011-10-03 22:40:59 UTC
Don't forget that Fedora does not use classic /etc/mtab (we use symlink to /proc/mounts). The subvol= option is not available in the /proc/mounts file.

Anyway, the information about filesystem root directory (e.g. "/<subvolume>") is stored in the /proc/self/mountinfo file. 

You have to use findmnt(8) to see more advanced information about mountpoints:

 # mount /dev/sdb /mnt/test -o subvol=sub

 # findmnt /mnt/test
 TARGET    SOURCE         FSTYPE OPTIONS
 /mnt/test /dev/sdb[/sub] btrfs  rw,relatime,ssd
                   ^^^^^