Results 1 to 6 of 6

Thread: external drive /home empty with btrfs, xfs /home shows

  1. #1

    Default external drive /home empty with btrfs, xfs /home shows

    Curious if somebody can explain something I ran into. I have two external drives with Leap 15.1 installs. One was done as separate partitions and has an xfs home partition, one--for whatever reason--was a single partition btrfs with the home folder included.
    When I attach these to my main system as an external drive to grab files the xfs partition will mount and show user folders in the /home and files. The btrfs one will mount and show all file systems except the /home folder shows as empty.
    I'm curious if this is because of some internal /home mounting issue with the linux filesystem, User login related, or just some odd behaviour with btrfs and /home partitions.

    Thanks in advance

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    13,329
    Blog Entries
    3

    Default Re: external drive /home empty with btrfs, xfs /home shows

    This is probably because "/home" is defined as a subvolume. And that subvolume needs to be separately mounted. When it has not been mounted, the directory will appear to be empty.

    Some of the other directories are also subvolumes, and will appear to be empty.

    Presumably, when you plug in an external "btrfs" drive, the software mounts the drive but fails to mount the subvolumes. You would probably need to mount them at the root command line if you need them to be mounted.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3

    Default Re: external drive /home empty with btrfs, xfs /home shows

    Quote Originally Posted by nrickert View Post
    This is probably because "/home" is defined as a subvolume. And that subvolume needs to be separately mounted. When it has not been mounted, the directory will appear to be empty.

    Some of the other directories are also subvolumes, and will appear to be empty.

    Presumably, when you plug in an external "btrfs" drive, the software mounts the drive but fails to mount the subvolumes. You would probably need to mount them at the root command line if you need them to be mounted.
    Yes you are correct. It's mounting the drive but not sub-volumes.
    So I tried this after realizing there is a subvol option
    Code:
    sudo mount -o subvol=/@/home /dev/sdd2 /mount/location
    And I can now see the user subfolders.
    Thanks for the tip.

    Off to do some reading, as I imagine there's ways to list what sub-volumes are on the drive that I'm not seeing during the automatic OS mount.
    Also curious where the data actually lies on the structure of the drive? Is it hidden from view until specifically mounted?

    Cheers

  4. #4
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    1,295

    Default Re: external drive /home empty with btrfs, xfs /home shows

    Quote Originally Posted by RedRoosterBooster View Post
    Yes you are correct. It's mounting the drive but not sub-volumes.
    So I tried this after realizing there is a subvol option
    Code:
    sudo mount -o subvol=/@/home /dev/sdd2 /mount/location
    And I can now see the user subfolders.
    Thanks for the tip.

    Off to do some reading, as I imagine there's ways to list what sub-volumes are on the drive that I'm not seeing during the automatic OS mount.
    Also curious where the data actually lies on the structure of the drive? Is it hidden from view until specifically mounted?

    Cheers
    "A Btrfs filesystem has a default subvolume, which is initially set to be the top-level subvolume and which is mounted if no subvol or subvolid option is specified."

    https://btrfs.wiki.kernel.org/index.php/SysadminGuide

    Code:
    erlangen:~ # btrfs subvolume get-default /
    ID 523 gen 26571 top level 266 path @/.snapshots/241/snapshot
    erlangen:~ #
    List of subvolumes:

    Code:
    erlangen:~ # btrfs subvolume list /
    ID 256 gen 20476 top level 5 path @
    ID 258 gen 26598 top level 256 path @/var
    ID 259 gen 26475 top level 256 path @/usr/local
    ID 260 gen 26598 top level 256 path @/tmp
    ID 261 gen 24120 top level 256 path @/srv
    ID 262 gen 26470 top level 256 path @/root
    ID 263 gen 20746 top level 256 path @/opt
    ID 264 gen 22658 top level 256 path @/boot/grub2/x86_64-efi
    ID 265 gen 20492 top level 256 path @/boot/grub2/i386-pc
    ID 266 gen 26567 top level 256 path @/.snapshots
    ID 273 gen 78 top level 266 path @/.snapshots/2/snapshot
    ID 488 gen 6708 top level 266 path @/.snapshots/212/snapshot
    ID 489 gen 6713 top level 266 path @/.snapshots/213/snapshot
    ID 513 gen 15701 top level 266 path @/.snapshots/234/snapshot
    ID 517 gen 15733 top level 266 path @/.snapshots/235/snapshot
    ID 522 gen 16762 top level 266 path @/.snapshots/240/snapshot
    ID 523 gen 26571 top level 266 path @/.snapshots/241/snapshot
    ID 526 gen 17695 top level 266 path @/.snapshots/244/snapshot
    ID 528 gen 17708 top level 266 path @/.snapshots/245/snapshot
    ID 550 gen 23775 top level 266 path @/.snapshots/266/snapshot
    ID 551 gen 23778 top level 266 path @/.snapshots/267/snapshot
    ID 552 gen 23891 top level 266 path @/.snapshots/268/snapshot
    ID 554 gen 26335 top level 266 path @/.snapshots/269/snapshot
    ID 557 gen 26335 top level 266 path @/.snapshots/272/snapshot
    ID 558 gen 26335 top level 266 path @/.snapshots/273/snapshot
    ID 559 gen 26335 top level 266 path @/.snapshots/274/snapshot
    ID 560 gen 26335 top level 266 path @/.snapshots/275/snapshot
    erlangen:~ #
    Snapshots are accessible here:

    Code:
    erlangen:~ # ls /.snapshots/
    2  212  213  234  235  240  241  244  245  266  267  268  269  272  273  274  275  grub-snapshot.cfg
    erlangen:~ #
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), openSUSE Tumbleweed, KDE Plasma 5

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    13,329
    Blog Entries
    3

    Default Re: external drive /home empty with btrfs, xfs /home shows

    Quote Originally Posted by RedRoosterBooster View Post
    Off to do some reading, as I imagine there's ways to list what sub-volumes are on the drive that I'm not seeing during the automatic OS mount.
    There is probably an "/etc/fstab" file there in the root volume, which lists the subvolumes. But I think you are looking for a way to identify the subvolumes from the volume structure, and I don't know how to do that.

    Also curious where the data actually lies on the structure of the drive? Is it hidden from view until specifically mounted?
    I have mostly avoided "btrfs" except for a little testing. So I don't have an answer for that.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  6. #6
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    1,295

    Default Re: external drive /home empty with btrfs, xfs /home shows

    Quote Originally Posted by nrickert View Post
    There is probably an "/etc/fstab" file there in the root volume, which lists the subvolumes. But I think you are looking for a way to identify the subvolumes from the volume structure, and I don't know how to do that.
    You may mount top level subvolume. All subvolumes are now accessible without mounting them:

    Code:
    erlangen:~ # mount -o subvolid=5 /dev/sdb5 /mnt
    erlangen:~ # ls /mnt/@/
    .snapshots  boot  etc  opt  root  srv  tmp  usr  var
    erlangen:~ #
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), openSUSE Tumbleweed, KDE Plasma 5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •