What's new

[SOLVED] Unable to run e2fsck /dev/sdb1 is in use

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Xentrk

Part of the Furniture
I am getting disk error messages my USB drives that I have entware and ab-solution 3 installed. Both are formatted as EXT2.

Code:
kernel: EXT2-fs (sdb1): previous I/O error to superblock detected

As a result, I need to run the e2fsck command. I first run the services-stop script which contains the code

Code:
/opt/etc/init.d/rc.unslung stop

I issue the command umount –l /dev/sdb1. As seen below, my USB is unmount status

upload_2017-1-8_18-9-37.png


But when I try to run the e2fsck command, I get the /dev/sdb1 is in use. E2fsck: Cannot continue, aborting.

upload_2017-1-8_18-9-53.png


Is there another process locking up these devices that I need to kill before I can run e2fsck them? I turned off SMB on the web GUI but no change in status.
 
"fuser" can show you who's using it.
 
"fuser" can show you who's using it.
Thank you @Nullity,

I tried the command but received -sh: fuser: not found
I did a search of entware packages and see there is a package:

Code:
fuse-utils - 2.9.0-2 - FUSE (Filesystem in UserSpacE) This package contains the FUSE utilities. - fusermount - ulockmgr_server

I installed the package successfully. The command is still not recognized. Searching the www for more information.
 
Do you have a swap file defined on the USB?
I do not....and I from the research I did yesterday, I'm starting to think that may be the reason I get the error messages. I formatted the entire USB as ext2 with no swap space...
 
Last edited:
fuser is normally part of psmisc. fuse is something completely different ;)

That is the one! Thanks @ColinTaylor.
Code:
admin@RT-AC88U-5248:/tmp/etc# fuser
No process specification given
Usage: fuser [-fMuvw] [-a|-s] [-4|-6] [-c|-m|-n SPACE] [-k [-i] [-SIGNAL]] NAME...
       fuser -l
       fuser -V
Show which processes use the named files, sockets, or filesystems.
  -a,--all              display unused files too
  -i,--interactive      ask before killing (ignored without -k)
  -k,--kill             kill processes accessing the named file
  -l,--list-signals     list available signal names
  -m,--mount            show all processes using the named filesystems or block device
  -M,--ismountpoint     fulfill request only if NAME is a mount point
  -n,--namespace SPACE  search in this name space (file, udp, or tcp)
  -s,--silent           silent operation
  -SIGNAL               send this signal instead of SIGKILL
  -u,--user             display user IDs
  -v,--verbose          verbose output
  -w,--writeonly        kill only processes with write access
  -V,--version          display version information
  -4,--ipv4             search IPv4 sockets only
  -6,--ipv6             search IPv6 sockets only
  -                     reset options
  udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]
 
This is interesting. I was able to run e2fsck on /dev/sdc1. It was the sftp-server process that had it locked up. I closed my sftp session and killed the pid. I was then able to successfully run e2fsck.

/dev/sdb1 is being used by dnsmasq. I have issued the kill -9 command to kill the process. But a new one always starts up. Anyone know how to stop that from happening? I am tempted to plug the USB into my pfSense appliance so I can run e2fsck on it. But only want to try that after I have exhausted all attempts of trying on the router.

Code:
admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdb1
                     USER        PID ACCESS COMMAND
/dev/sdb1:           admin    kernel mount /tmp/mnt/absolution
                     nobody    26588 F.... dnsmasq

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdc1
                     USER        PID ACCESS COMMAND
/dev/sdc1:           admin    kernel mount /tmp/mnt/entware
                     admin      5991 ...e. sftp-server
                     nobody     6604 ....m pixelserv-tls
                     admin      6606 ....m pixelserv-tls
                     admin     22104 ...e. sftp-server

admin@RT-AC88U-5248:/jffs/scripts# ./services-stop
 Checking pixelserv-tls (AB-Solution)...              alive.
 Shutting down pixelserv-tls...              done.

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdb1
                     USER        PID ACCESS COMMAND
/dev/sdb1:           admin    kernel mount /tmp/mnt/absolution
                     nobody    26588 F.... dnsmasq

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdc1
                     USER        PID ACCESS COMMAND
/dev/sdc1:           admin    kernel mount /tmp/mnt/entware
                     admin      5991 ...e. sftp-server
                     admin     22104 ...e. sftp-server

admin@RT-AC88U-5248:/jffs/scripts# kill -9 26588

admin@RT-AC88U-5248:/jffs/scripts# kill -9 5991

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdb1
                     USER        PID ACCESS COMMAND
/dev/sdb1:           admin    kernel mount /tmp/mnt/absolution
                     nobody    27791 F.... dnsmasq

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdc1
                     USER        PID ACCESS COMMAND
/dev/sdc1:           admin    kernel mount /tmp/mnt/entware

admin@RT-AC88U-5248:/jffs/scripts# kill -9 27791

admin@RT-AC88U-5248:/jffs/scripts# e2fsck -y -f /dev/sdc1
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #243 (65268, counted=7924).
Fix? yes

Free blocks count wrong (1979659, counted=1922315).
Fix? yes
entware: ***** FILE SYSTEM WAS MODIFIED *****
entware: 448/499712 files (2.7% non-contiguous), 76533/1998848 blocks

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdb1
                     USER        PID ACCESS COMMAND
/dev/sdb1:           nobody    28062 F.... dnsmasq
 
I got the e2fsck command to work for sdb1. Fuser has a –k option which will send a signal to each process using the mount. Upon first attempt at using this option, it appeared to be successful. But when I ran e2fsck again, I got the “in use” message. On second attempt, I added the –i option. I got no errors in return. I then reran fuser with –v –m options and dnsmasq shows up again. I killed the PID, then reran fuser –v –m and no processes showed as using the disk. I then was able to rerun e2fsck successfully! In prior attempts, another dnsmasq always spawned up again, which prevented me from running e2fsck.

Code:
admin@RT-AC88U-5248:/jffs/scripts# fuser -v -k /dev/sdb1
admin@RT-AC88U-5248:/jffs/scripts# e2fsck -y -v -f /dev/sdb1
e2fsck 1.42.13 (17-May-2015)
/dev/sdb1 is in use.
e2fsck: Cannot continue, aborting.

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdb1
                     USER        PID ACCESS COMMAND
/dev/sdb1:           nobody    28062 F.... dnsmasq

admin@RT-AC88U-5248:/jffs/scripts# fuser -v -k -i /dev/sdb1
admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdb1
                     USER        PID ACCESS COMMAND
/dev/sdb1:           nobody    28062 F.... dnsmasq

admin@RT-AC88U-5248:/jffs/scripts# kill -9 28062
admin@RT-AC88U-5248:/jffs/scripts# fuser -v -m /dev/sdb1
admin@RT-AC88U-5248:/jffs/scripts# e2fsck -y -v -f /dev/sdb1
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
          58 inodes used (0.01%, out of 976896)
           8 non-contiguous files (13.8%)
           1 non-contiguous directory (1.7%)
             # of inodes with ind/dind/tind blocks: 22/12/0
      229895 blocks used (5.89%, out of 3902464)
           0 bad blocks
           0 large files
          39 regular files
          10 directories
           0 character device files
           0 block device files
           0 fifos
           0 links
           0 symbolic links (0 fast symbolic links)
           0 sockets
------------
          49 files

Thank you!! I am very GRATEFUL for all of the help!
 
In prior attempts, another dnsmasq always spawned up again, which prevented me from running e2fsck.
Disable logging and ad-blocking, then exit AB, this prevents dnsmasq from writing to the device. Pixelserv-tls is also stopped if ad-blocking is off.
 
Disable logging and ad-blocking, then exit AB, this prevents dnsmasq from writing to the device. Pixelserv-tls is also stopped if ad-blocking is off.

Thanks. That helps explain what was going on. I had only run the services-stop script. Now I know what to do differently next time. But I learned about "fuser" in the process so that was good. :)
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top