I have many years of UNIX experience, but I think i made a fatal mistake:
Seeing messages during boot about non-empty mount points, I took the chance to clean them up while migration a system to a new environment.
I booted the SLES Rescue System, mounted the root filesystem and the basic system structure (proc, sys, dev) on /mnt
, then did chroot /mnt
and mount -va
.
So everything looked nice, I adjusted some configuration settings and while unmounting I checked the mount points.
For example:
/var/cache
was mounted, umount
succeeded, but still ll /var/cache
showed a non-empty mount point while the filesystem was displayed not mounted.
So I removed the contents.
Basically I repeated the steps for every filesystem mounted, then left the chroot
environment, umounted the rest and rebooted.
Unfortunately the system won't boot as GRUB complained it cannot find normal.mod
.
So is this a feature of btrfs subvolumes? Who can explain what was going on?
/etc/fstab
As I was asked for /etc/fstab
, here is what a typical system has:
/dev/sys/root / btrfs defaults 0 0
/dev/sys/root /var btrfs subvol=/@/var 0 0
/dev/sys/root /usr/local btrfs subvol=/@/usr/local 0 0
/dev/sys/root /tmp btrfs subvol=/@/tmp 0 0
/dev/sys/root /srv btrfs subvol=/@/srv 0 0
/dev/sys/root /root btrfs subvol=/@/root 0 0
/dev/sys/root /opt btrfs subvol=/@/opt 0 0
UUID=9fd27493-d194-48ba-a4bc-3551123e0d3b /home xfs defaults 0 0
/dev/sys/boot /boot btrfs defaults 0 0
UUID=0092-D1D5 /boot/efi vfat utf8 0 2
/dev/sys/root /.snapshots btrfs subvol=/@/.snapshots 0 0
fstab
I can only guess (so not an answer). Suppose there is a subvolume namedboot
. Suppose you mountsubvol=/whatever
as/
and thensubvol=/whatever/boot
as/boot/
. If youumount
/boot
then you will still see its content – not as a mounted subvolume but as a subvolume that exists under/whatever
in the Btrfs subvolume tree (see this answer if this is confusing to you). This is a possible scenario where files in/boot
are the same regardless if/boot
is mounted.systemd
silently remounting the filesystem, so I did not clean up the mountpoint (as expected), but cleaned the actual mounted filesystem. Unfortunately I cannot prove any more.