#3348 PR merged
: Call 'lsblk' with 'MOUNTPOINTS' to show all mounted btrfs subvolumes¶
Labels: enhancement
, fixed / solved / done
jsmeix opened issue at 2024-11-27 08:57:¶
-
Type: Enhancement
-
Impact: Normal
-
How was this pull request tested?
Tested "by the way" in
https://github.com/rear/rear/pull/3347 -
Description of the changes in this pull request:
In layout/save/GNU/Linux/100_create_layout_file.sh
call 'lsblk' with 'MOUNTPOINTS' with plural 'S'
to show all mounted btrfs subvolumes
in contrast to 'MOUNTPOINT' that shows only
a random one of the mounted btrfs subvolumes.
jsmeix commented at 2024-11-27 08:58:¶
For my test see
https://github.com/rear/rear/pull/3347#issuecomment-2503237118
What I get with the changes here in disklayout.conf
as header comment:
# Disk layout dated 20241127092608 (YYYYmmddHHMMSS)
# NAME KNAME PKNAME TRAN TYPE FSTYPE LABEL SIZE MOUNTPOINTS UUID WWN
# /dev/sr0 /dev/sr0 sata rom iso9660 SLE-15-SP6-Full-x86_6493.51.001 15.3G 2024-06-13-19-56-33-00
# /dev/vda /dev/vda virtio disk 15G
# |-/dev/vda1 /dev/vda1 /dev/vda virtio part 8M
# |-/dev/vda2 /dev/vda2 /dev/vda virtio part btrfs 13G /var bad9f5d9-6a37-4902-b5fc-ded16e84f357
# | /usr/local
# | /tmp
# | /srv
# | /root
# | /home
# | /opt
# | /boot/grub2/x86_64-efi
# | /boot/grub2/i386-pc
# | /.snapshots
# | /
# `-/dev/vda3 /dev/vda3 /dev/vda virtio part swap 2G [SWAP] 1b15280b-7649-43dc-a939-2ff39d41839b
For comparison between 'MOUNTPOINTS' and 'MOUNTPOINT'
on my original SLES16-SP6 test VM
# lsblk -ipo NAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINTS
NAME TRAN TYPE FSTYPE SIZE MOUNTPOINTS
/dev/sr0 sata rom iso9660 15.3G
/dev/vda virtio disk 15G
|-/dev/vda1 virtio part 8M
|-/dev/vda2 virtio part btrfs 13G /var
| /usr/local
| /tmp
| /srv
| /root
| /home
| /opt
| /boot/grub2/x86_64-efi
| /boot/grub2/i386-pc
| /.snapshots
| /
`-/dev/vda3 virtio part swap 2G [SWAP]
# lsblk -ipo NAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT
NAME TRAN TYPE FSTYPE SIZE MOUNTP
/dev/sr0 sata rom iso9660 15.3G
/dev/vda virtio disk 15G
|-/dev/vda1 virtio part 8M
|-/dev/vda2 virtio part btrfs 13G /var
`-/dev/vda3 virtio part swap 2G [SWAP]
versus after "rear recover" on another test VM
# lsblk -ipo NAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINTS
NAME TRAN TYPE FSTYPE SIZE MOUNTPOINTS
/dev/sr0 sata rom iso9660 84.1M
/dev/vda virtio disk 15G
|-/dev/vda1 virtio part 8M
|-/dev/vda2 virtio part btrfs 13G /usr/local
| /tmp
| /var
| /root
| /srv
| /opt
| /home
| /boot/grub2/x86_64-efi
| /boot/grub2/i386-pc
| /.snapshots
| /
`-/dev/vda3 virtio part swap 2G [SWAP]
# lsblk -ipo NAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT
NAME TRAN TYPE FSTYPE SIZE MOUNTPOINT
/dev/sr0 sata rom iso9660 84.1M
/dev/vda virtio disk 15G
|-/dev/vda1 virtio part 8M
|-/dev/vda2 virtio part btrfs 13G /usr/local
`-/dev/vda3 virtio part swap 2G [SWAP]
So 'MOUNTPOINT' is misleading when several btrfs subvolumes
of one btrfs are mounted because the 'MOUNTPOINT' output
looks as if the btrfs on /dev/vda2 is only mounted at
the mountpoint /var on my original SLES16-SP6 test VM
versus it looks as if the btrfs on /dev/vda2 is only mounted
at the mountpoint /usr/local on my other test VM
after "rear recover" of my original SLES16-SP6 test VM
but actually several btrfs subvolumes of the btrfs
on /dev/vda2 are mounted at several mountpoints
which are same on my other test VM after "rear recover"
as they have been on my original SLES16-SP6 test VM
so only the 'MOUNTPOINTS' output shows that "rear recover"
did everything right while in contrast the 'MOUNTPOINT'
output looks as if "rear recover" did something wrong.
jsmeix commented at 2024-11-27 09:07:¶
@rear/contributors
I would appreciate it if you could have a look here
because I would like to have this included in ReaR 2.8
to avoid the misleading 'lsblk ... MOUNTPOINT' output
when several btrfs subvolumes of one btrfs
are mounted at several mountpoints.
jsmeix commented at 2024-11-28 11:16:¶
Where the 'lsblk' option 'MOUNTPOINTS' works
for me on SUSE/openSUSE:
'lsblk ... MOUNTPOINTS' works on my SLES15 SP5 test VM
and on my openSUSE Leap 15.5 workstation where both have
lsblk from util-linux 2.37.4
'lsblk ... MOUNTPOINTS' also works on my SLES15 SP4 test VM
with lsblk from util-linux 2.37.2
'lsblk ... MOUNTPOINTS' fails on my SLES12 SP5 test VM
with lsblk from util-linux 2.33.2
# lsblk -ipo NAME,MOUNTPOINTS || echo $?
lsblk: unknown column: MOUNTPOINTS
1
jsmeix commented at 2024-12-03 13:26:¶
Only FYI because it could be of interest:
At least on SLES12-SP5 'lsblk'
# lsblk --version
lsblk from util-linux 2.33.2
fails with a wrong error message when 'MOUNTPOINTS' is used:
# lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINTS,UUID,WWN
lsblk: unknown column: MOUNTPOINTS,UUID,WWN
which looks as if MOUNTPOINTS and UUID and WWN are unknown columns
but actually only MOUNTPOINTS is an unknown column:
# lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT,UUID,WWN
NAME KNAME PKNAME TRAN TYPE FSTYPE LABEL SIZE MOUNTPOINT UUID WWN
/dev/sda /dev/sda ata disk 15G
|-/dev/sda1 /dev/sda1 /dev/sda part swap 2G [SWAP] de7df77b-ceb5-4617-ab78-b618474a41a9
`-/dev/sda2 /dev/sda2 /dev/sda part btrfs 13G / b3fc4e1d-63bc-4ec7-b131-0c43b8245b68
/dev/sr0 /dev/sr0 ata rom iso9660 SLE-12-SP5-Server-DVD-x86_640372 3.8G 2019-11-09-00-58-33-00
[Export of Github issue for rear/rear.]