External luks drive /home empty with btrfs

Hi all,

I had replaced the ssd on my laptop due to being too small (120Gb) and installed a fresh Tumbleweed on the new drive.
All that I want now is to copy data from old ssd /home to the new installation. I found the explanation why I’m seeing the old /home as being empty - as it’s a btrfs subvolume

So I tried:

simona@localhost:~> sudo btrfs subvolume list -p /run/media/simona/1ee94850-b307-408d-9c2e-afc945e3e73c
ID 256 gen 30 parent 5 top level 5 path @
ID 257 gen 328375 parent 256 top level 256 path @/var
ID 258 gen 327150 parent 256 top level 256 path @/usr/local
ID 259 gen 238158 parent 256 top level 256 path @/srv
ID 260 gen 326856 parent 256 top level 256 path @/root
ID 261 gen 327716 parent 256 top level 256 path @/opt
ID 262 gen 328344 parent 256 top level 256 path @/home
ID 263 gen 222065 parent 256 top level 256 path @/boot/grub2/x86_64-efi
ID 264 gen 125342 parent 256 top level 256 path @/boot/grub2/i386-pc
ID 265 gen 328096 parent 256 top level 256 path @/.snapshots
ID 266 gen 328808 parent 265 top level 265 path @/.snapshots/1/snapshot
ID 870 gen 212031 parent 265 top level 265 path @/.snapshots/473/snapshot
ID 871 gen 214715 parent 265 top level 265 path @/.snapshots/474/snapshot
ID 872 gen 214722 parent 265 top level 265 path @/.snapshots/475/snapshot
ID 873 gen 214725 parent 265 top level 265 path @/.snapshots/476/snapshot
ID 876 gen 220339 parent 265 top level 265 path @/.snapshots/479/snapshot
ID 877 gen 237190 parent 265 top level 265 path @/.snapshots/480/snapshot
simona@localhost:~> LC_ALL=C sudo mount -o subvol=/@/home /run/media/simona/1ee94850-b307-408d-9c2e-afc945e3e73c /mnt/old_home
mount: /mnt/old_home: /run/media/simona/1ee94850-b307-408d-9c2e-afc945e3e73c is not a block device.
       dmesg(1) may have more information after failed mount system call.

and in dmesg I have

[  236.052899] device-mapper: uevent: version 1.0.3
[  236.052990] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: dm-devel@redhat.com
[  238.862521] BTRFS: device fsid 1ee94850-b307-408d-9c2e-afc945e3e73c devid 1 transid 331093 /dev/mapper/luks-3bb63d4c-1dec-4370-940e-bda3dee1b9c6 scanned by pool-udisksd (7903)
[  238.866068] BTRFS info (device dm-0): first mount of filesystem 1ee94850-b307-408d-9c2e-afc945e3e73c
[  238.866093] BTRFS info (device dm-0): using crc32c (crc32c-intel) checksum algorithm
[  238.866102] BTRFS info (device dm-0): disk space caching is enabled
[  543.169439] JFS: nTxBlock = 8192, nTxLock = 65536
[  543.197421] NILFS version 2 loaded
[  651.214853] BTRFS info (device sda2): qgroup scan completed (inconsistency flag cleared)
[ 2348.403294] fuseblk: Unknown parameter 'subvol'

Checking the man page for mount, there’s no mention of btrfs filesystem or subvol option.
Found a blog post about using pam_mount but I only want to mount it once, not at every login.

Thank you.

The problem is mount expects the source device (usually a partition) instead of directory /run/media/simona/1ee94850-b307-408d-9c2e-afc945e3e73c.

The btrfs partition can be found from the output of lsblk -f.

For example, if your btrfs partition is /dev/sda1, you would do:

# target /mnt/old_home must exist
# format is mount [options] <src> <dest>
sudo mount -o subvol=@/home /dev/sda1 /mnt/old_home

I am not sure I understand it complete. But when one wants to read/write files in Unix/Linux, the file system they are on must be mounted somewhere. I understand that there is no separate file system for /home , thus you mus mount / somewhere (e.g. /mnt is a good place for such “mounts for one time”).

Seems logical to me (and has nothing to do with the type of file system as you seem to think).

Problem is /sdb/sdb2 is encrypted so the btrfs volume is lower down in the hierarchy

simona@localhost:~> lsblk -f
NAME              FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
├─sda1            vfat   FAT32       7860-67A4                             510,6M     0% /boot/efi
├─sda2            btrfs              e336cfcd-e01f-43f6-a38e-fb56f81d2587  143,2G     8% /var
│                                                                                        /root
│                                                                                        /srv
│                                                                                        /usr/local
│                                                                                        /opt
│                                                                                        /boot/grub2/x86_64-efi
│                                                                                        /boot/grub2/i386-pc
│                                                                                        /.snapshots
│                                                                                        /
├─sda3            xfs                4ebd3dc2-1e49-4a4f-92ec-74f387649023  276,7G     2% /home
└─sda4            swap   1           b92618dc-3935-4fb9-ac7d-84331959c9f3                [SWAP]
├─sdb1            vfat   FAT16       0BA3-084D                                           
├─sdb2            crypto 1           3bb63d4c-1dec-4370-940e-bda3dee1b9c6                
│ └─luks-3bb63d4c-1dec-4370-940e-bda3dee1b9c6
│                 btrfs              1ee94850-b307-408d-9c2e-afc945e3e73c    5,4G    95% /run/media/simona/1ee94850-b307-408d-9c2e-afc945e3e73c
└─sdb3            crypto 1           c7080330-9447-454e-8992-d478162a0b39                

Went back to the mount man page and noticed that it recommends to use the UUID of the device so the successful command was

LC_ALL=C sudo mount -o subvol=/@/home UUID=1ee94850-b307-408d-9c2e-afc945e3e73c /mnt/old_home
1 Like

Can’t go wrong using the UUID, but it’s often used in config entries like fstab. Normally when user-mounting from the terminal, the device or device-mapper path is used for ease of use and readability.

Curious, what sort of encryption are you using? I’m using LUKS and it shows up as crypto_LUKS 1 for the one created by Yast installer and crypto_LUKS 2 for the ones I created.

I f I remember correctly it’s the one configurable from installer.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.