unmounted logical volume is "busy"?
I'm trying to shrink an ext4 filesystem on a CentOS 6 server. I did a lazy unmount of the filesystem while I waited for some processes to finish running. They've all finished running but I can't seem to do anything with the filesystem. How can I see what is using the volume and stop it?
resize2fs
[root@planck ~]# resize2fs -P /dev/vg_dev/lv_home
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Device or resource busy while trying to open /dev/vg_dev/lv_home
Couldn't find valid filesystem superblock.
fsck
[root@planck ~]# fsck /dev/vg_dev/lv_home
fsck from util-linux-ng 2.17.2
e2fsck 1.42.9 (28-Dec-2013)
/dev/mapper/vg_dev-lv_home is in use.
e2fsck: Cannot continue, aborting.
umount
[root@planck ~]# umount /dev/vg_dev/lv_home
umount: /dev/vg_dev/lv_home: not mounted
lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_dev -wi-ao---- 5.86t
lv_root vg_dev -wi-ao---- 50.00g
lv_swap vg_dev -wi-ao---- 5.44g
Solution 1:
fuser -mv /dev/vg_dev/lv_home
should show you the process PID you need to kill to free up the device.
For example:
# fuser -mv /dev/vg_dev/lv_home
USER PID ACCESS COMMAND
/dev/vg_dev/lv_home:
sbonds 9627 ..c.. bash
Now, you may not be able to actually kill it if it's blocked on I/O or some other uninterruptible reason.