Score:1

why cannot umount an lvm partition?

it flag

I have an Ubuntu Server 22.04. The disks are managed using LVM partition. My /var partition needs a size increasing. So I thought to reduce the /home size, so that I could increase /var.

root@localhost:/mnt# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0  53.3M  1 loop /snap/snapd/19457
loop1         7:1    0 111.9M  1 loop /snap/lxd/24322
loop2         7:2    0  63.4M  1 loop /snap/core20/1974
sda           8:0    0 465.8G  0 disk
sdb           8:16   1     0B  0 disk
sdc           8:32   1     0B  0 disk
sdd           8:48   1     0B  0 disk
sde           8:64   1     0B  0 disk
sdf           8:80   0  74.5G  0 disk
├─sdf1        8:81   0     1M  0 part
├─sdf2        8:82   0     1G  0 part /boot
└─sdf3        8:83   0  73.5G  0 part
  ├─vg-root 253:0    0    50G  0 lvm  /
  ├─vg-var  253:1    0   7.8G  0 lvm  /var
  ├─vg-usr  253:2    0    60G  0 lvm  /usr
  ├─vg-tmp  253:3    0     8G  0 lvm  /tmp
  └─vg-home 253:4    0 413.5G  0 lvm
sdg           8:96   0 465.8G  0 disk
├─vg-root   253:0    0    50G  0 lvm  /
├─vg-var    253:1    0   7.8G  0 lvm  /var
├─vg-usr    253:2    0    60G  0 lvm  /usr
└─vg-home   253:4    0 413.5G  0 lvm
root@localhost:/mnt# df -h
Filesystem                                                                                    Size  Used Avail Use% Mounted on
tmpfs                                                                                         794M  1.4M  793M   1% /run
/dev/mapper/vg-root                                                                            50G  4.1G   43G   9% /
/dev/disk/by-id/dm-uuid-LVM-Den324vgGMdBQrsjrKyrasUtU1NAEV5lNap1uxEhuN2eMmWivFx921LEtPAxYSDd   59G  3.7G   53G   7% /usr
tmpfs                                                                                         3.9G  4.0K  3.9G   1% /dev/shm
tmpfs                                                                                         5.0M     0  5.0M   0% /run/lock
/dev/mapper/vg-home                                                                           407G  118G  273G  31% /home
/dev/sdf2                                                                                     974M  131M  777M  15% /boot
/dev/mapper/vg-tmp                                                                            7.8G  120K  7.4G   1% /tmp
/dev/mapper/vg-var                                                                            7.6G  6.0G  1.3G  83% /var
tmpfs                                                                                         794M  4.0K  794M   1% /run/user/1000

The first problem I faced was to umount /home. Even if I am logged as root and I am under mnt directory. So I resolved that by root@localhost:/mnt# umount -f /home , thereafter checking lsof /home and no processes were found.

After that I wanted to check the file -system error using e2fsck -fy /dev/mapper/vg-home and surprisingly I got:

root@localhost:/mnt# e2fsck -fy /dev/mapper/vg-home
e2fsck 1.46.5 (30-Dec-2021)
/dev/mapper/vg-home is in use.
e2fsck: Cannot continue, aborting.

I ran lsof /dev/mapper/vg-home and no processes were running. I don't understand why /dev/mapper/vg-home is in use even if /home is umount?

Any suggestion, idea or help is very appreciated.

EDIT:

 # lvscan

 ACTIVE            '/dev/vg/root' [50.00 GiB] inherit
 ACTIVE            '/dev/vg/var' [<7.76 GiB] inherit
 ACTIVE            '/dev/vg/usr' [60.00 GiB] inherit
 ACTIVE            '/dev/vg/tmp' [8.00 GiB] inherit
 ACTIVE            '/dev/vg/home' [413.52 GiB] inherit
hr flag
What does `lvscan` say about the volume(s)?
carl avatar
it flag
@steeldriver - you can now see what ```lvscan``` said. I have mounted the ```/home```.
waltinator avatar
it flag
You can't unmount an in-use partition. `/var` is heavily used. Rather, boot from a live USB stick (your install medium, in "Try Ubuntu" mode.
carl avatar
it flag
@waltinator - my problem is ```/home``` and ```/dev/vg/home``` to ```umount``` and reduce the size so that I can increase the ```/var``` size. I don't need to ```umount``` ```/var``` to increase the size.
waltinator avatar
it flag
You could use `lsof` with the `+D directory` option, or `fuser` to see all the processes with files open on that directory and subdirectories, that you would need to kill before you unmount. Don't do that. Rather, boot from a live USB stick (your install medium, in "Try Ubuntu" mode
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.