umount /dev/mapper/nvmeVg-home
umount: /home: target is busy
I looked at this answer and found this useful page I was unable to solve my problem before posting here.
My /var
directory is full. /var
is on a lvm. Last night, I went to increase the size of /var
and accidentally executed lvextend -L+50G /dev/mapper/nvmeVg-home
when I should have lvextend -L +50G dev/mapper/nvmeVg-var
oops.
So no big deal right? lvextend -L-50G /dev/mapper/nvmeVg-home
results in
Size may not be negative. Invalid argument for --size: -50G. Error during parsing of command line:
So then I see to shrink a non root volume I must umount the device first. Sure no problem: /umount /dev/mapper/nvmeVg-home
results in
umount: /home: target is busy
So I lsof /dev/mapper/nvmeVg-home
and get lots of output. So if I am unable to umount because /home has files in use, then I tried lsof | grep /dev/mapper/nvme
returned nothing. I was expecting to see the total number of files open. Then I tried /lsof +f -- /dev/mapper/nvmeVg-home
which returned alot of files currently in use. Fine. I then notice /home is mounted to multiple volume groups?(still uncertain on terminology). That's odd. Doesn't look right. Could this be a second issue with in my issue?
nvme0n1 259:0 0 953.9G 0 disk
├─nvme0n1p1 259:1 0 953M 0 part
├─nvme0n1p2 259:2 0 46.6G 0 part
│ └─nvmeVg-var 253:2 0 50G 0 lvm /var
├─nvme0n1p3 259:3 0 46.6G 0 part
│ ├─nvmeVg-var 253:2 0 50G 0 lvm /var
│ ├─nvmeVg-home 253:3 0 150G 0 lvm /home
│ └─nvmeVg-root 253:4 0 100G 0 lvm
├─nvme0n1p4 259:4 0 46.6G 0 part
│ └─nvmeVg-home 253:3 0 150G 0 lvm /home
├─nvme0n1p5 259:5 0 46.6G 0 part
│ └─nvmeVg-home 253:3 0 150G 0 lvm /home
├─nvme0n1p6 259:6 0 46.6G 0 part
│ └─nvmeVg-root 253:4 0 100G 0 lvm
├─nvme0n1p7 259:7 0 46.6G 0 part
│ └─nvmeVg-root 253:4 0 100G 0 lvm
├─nvme0n1p8 259:8 0 46.6G 0 part
│ └─nvmeVg-home 253:3 0 150G 0 lvm /home
├─nvme0n1p9 259:9 0 46.6G 0 part
├─nvme0n1p10 259:10 0 46.6G 0 part
├─nvme0n1p11 259:11 0 46.6G 0 part
└─nvme0n1p12 259:12 0 1G 0 part
I feel like it is wise to pause and reach out for help at this point.
lvextend
can only increase the size. This has nothing to do with being mounted. Trylvreduce
orlvresize
instead, but be very careful not to reduce too much. Thelsof
command, without options, doesn't print the device on which a file is located, therefore your grepping for nvme returns nothing. /home is not mounted multiple times, but is spread over multiple physical volumes. In short, you have no issue, just a slight misunderstanding how things work. – berndbausch Feb 15 '21 at 19:03-r
option. It also resizes the filesystem. If /home is XFS, however, the command might refuse working, since XFS can't be reduced. – berndbausch Feb 15 '21 at 19:12