How to umount /var...?

Hi Folks,

I’m wanting to reformat /var (ext to xfs).
Also, /home is to go (to /var/home).
I can not boot from USB dongle (I don’t know why, but the machine has stopped recognising live USBs).

I’ve dropped to single-user, rsync’d /var to /home, unmounted /home (/dev/VG1/LV_home), checked nothing is using /var (fuser -cu /var) and it’s not, tried to umount /var and failed with umount: /var: target is busy. (it’s not), mounted /dev/VG1/LV_home on top of /var (/dev/VG1/LV_var) and tried to umount /dev/VG1/LV_var and failed with umount: /dev/VG1/LV_var: umount failed: Invalid argument, read with interest this bug 1494014 and made the changes to /etc/fstab and run systemctl daemon-reload and then done all the above again: all to no avail…

How on Earth do I get systemd to release /var so I can work with it?


Appendix B. Partitioning reference Red Hat Enterprise Linux 9 | Red Hat Customer Portal writes:

If /usr or /var is partitioned separately from the rest of the root volume, the boot process becomes much more complex because these directories contain boot-critical components. In some situations, such as when these directories are placed on an iSCSI drive or an FCoE location, the system may either be unable to boot, or it may hang with a Device is busy error when powering off or rebooting.

This limitation only applies to /usr or /var, not to directories under them. For example, a separate partition for /var/www works without issues.

That might partially explain why /var (that is “just a directory” in / volume by default) behaves in peculiar manner.

Hmm, it’s not a very encouraging prognosis…

That warning about a separate /var partition is interesting. I’ve always had /var on a separate partition, and I’ve never had a problem with that. There are quite a few directories under /var that have the potential for wild growth, and running out of space on a root filesystem is a much bigger problem than a full /var.

This warning isn’t new for RHEL 9. The installation guide for RHEL 8 has the same warning.

Indeed. Isn’t/wasn’t there /var/run that by nature is mounted “early”? (Some volumes are mounted by “init” within initramfs, while others are safe to delay until system is “mostly up”.)

The /usr is interesting too. In principle, it could be read-only and shared by multiple systems – although not the (RPM) package managed version of it. Furthermore, initramfs, /sbin, and /bin used to have the “needed before boot” utilitites, but but now the latter two are symlinks to /usr/{sbin,bin}, so the need for /usr is more than before.

That is something that you should solve, because without it options for “rescue” that does not depend on local drive are more limited. (How about PXE boot? No other machine that could run server for that?)

Well, I gave up trying and discovered a sd card slot on the mb that worked (will come back to the USB problem another day) - booted to a live fedora and then did what I wanted.
Now, it refuses to boot because systemd refuses to mount /var refuses to because it isn’t ext4… doh
Any pointers?

systemctl status var.mount
mount: /var: wrong fs type, bad option, bad superblock on /dev/mapper/VG1-LV_var, missing codepage or helper program, or other error.

Edit /etc/fstab - most likely it still has ext4 instead of being updated to xfs for /var.

Yup, my guess too - forgot to update file type, but I had to walk away from the job to realise that of course, and won’t be back for a few hours to confirm. Thx

For quite some time now, /var/run is just a symlink to /run, and the latter is a tmpfs mount. As for /var, I find that hiding under my /var mount point directory are directories lib and lib/hp (empty), with creation times that match my last boot time. So, it looks like something is indeed doing something with /var prior to my separate filesystem being mounted there. Absent some serious problem appearing, I’m still sticking with my separate /var for reasons stated above.

This has become quite off-topic for this thread, though.

That’s okay :smile:
Edit of fstab done; job done - had to relabel filesystem too - thanks for the interest.
Now for that usb problem…


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