How to resolve e2fsck is in use cannot continue


#1

1. Introduction

In case you get the following error even after unmounting all devices:

yourserver:~# LANG=C e2fsck /dev/storage_group/storage_logic
e2fsck 1.43.4 (31-Jan-2017)
/dev/storage_group/storage_logic is in use.
e2fsck: Cannot continue, aborting.

Check the following steps to resolve:

2. Open count references by Device Mapper (DM)

In case you encounter this failure, check the following command to watch Open count indication as follows:

yourserver:~# dmsetup info
Name: storage_group-storage_logic
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 1
Event number: 0
Major, minor: 254, 0
Number of targets: 1
UUID: LVM-2koSHz2EIrli4rKqHdc0liieVNMUe2anPeMEFotvMURFM8Yf8knS4kzgN1B9ycEs

In our case, everything was unmounted but it is still having a ref count of one. To fix the issue, try stopping the following services. Use them as a hint of services maintaining a reference to LVM devices:

yourserver:~# systemctl stop systemd-udevd
yourserver:~# systemd-udevd-control.socket
yourserver:~# systemd-udevd-kernel.socket

After running these commands (and other services to stop), keep on checking dmsetup info until it says Open count: 0

Reached this point, you will be able to run e2fsck as usual.