E2fsck to /dev/sda3 is in use. e2fsck: Cannot continue, aborting

Hello All,

I am really new to Linux or Debian I am currently having issue running e2fsck to /dev/sda3

I am getting this.

# e2fsck /dev/sda3
e2fsck 1.42.12 (29-Aug-2014)
/dev/sda3 is in use.
e2fsck: Cannot continue, aborting.

My server crashed and now my partitions are gone.

I’ve tried to unmount /dev/sda3 but I got this

#umount /dev/sda3
/umount: /dev/sda3: not mounted

I also tried to boot as single user but I still get the same result.

What do you see when run the following command?

fdisk -l

Do you get a list of partition such as /dev/sda3?

Hi,

# fdisk -l

Device      Start      End  Sectors  Size Type
/dev/sda1    2048     4095     2048    1M BIOS boot
/dev/sda2    4096   528383   524288  256M EFI System
/dev/sda3  528384 41943006 41414623 19.8G Linux LVM

Disk /dev/mapper/pve-root: 4.8 GiB, 5100273664 bytes, 9961472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/pve-swap: 2.4 GiB, 2550136832 bytes, 4980736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/pve-vm--100--disk--1: 32 GiB, 34359738368 bytes, 67108864 secto                                                                                        rs
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disk /dev/mapper/pve-data_meta0: 12 MiB, 12582912 bytes, 24576 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Also,

I’d like to add

root@pve:~# file /dev/sda3
/dev/sda3: block special (8/3)
root@pve:~# file -s /dev/sda3
/dev/sda3: LVM2 PV (Linux Logical Volume Manager), UUID: LZiRzJ-g6Ug-mIy6-V2sz-nl5l-Tr3c-Dmyrd3, size: 21204286976
root@pve:~#

First get all info about LVM and disk it used to make that LVM:

pvs
pvscan
pvdisplay

Note down info. Next, you can not simply run fsck on LVM. You must unmount Linux LVM /dev/sda3. In your case it is part of / file system. So you must boot your system in rescue mode. Most cloud provider have that options. Once booted type the following command:

vgscan --mknodes
vgchange -ay
fsck /dev/mapper/pve-root

Run fsck on all LMV info you got from pvdisplay/pvscan commands. If you are not using Cloud computing based VM and got real bare metal system boot into rescue mode and run above commands. HTH

How do I do that? I am now in rescue mode but I got this

#umount /dev/sda3
umount: /dev/sda3: not mounted

also tried e2fsck from rescue mode and I got this
#e2fsck /dev/sda3
e2fsck 1.43.6 (29-Aug-2017)
/dev/sda3 is in use.
e2fsck: Cannot continue, aborting.

Hi,

I booted the bare metal server to a live cd

But I am getting an error saying: e2fsck: Not a directory while trying to open /dev/sda3

[liveuser@localhost —]$ sudo fsck /dev/sda3 
fsck from util-linux 2.23.2 

[liveuser@localhost —]$ sudo e2fsck -y /dev/sda3 
e2fsck 1.42.9 (28-Dec-2013) 
ext2fs_open2: Bad magic number in super-block 
e2fsck: Superblock invalid, trying backup blocks... 
e2fsck: Bad magic number in super-block while trying to open /dev/sda3 

The superblock could not be read or does not describe a correct ext2 
filesystem. If the device is valid and it really contains an ext2 
filesystem (and not swap or ufs or something else), then the superblock 
is corrupt, and you might try running e2fsck with an alternate superblock: 
      e2fsck -b 8193 <device> 


[liveuser@localhost —]$ sudo e2fsck -b 8193 /dev/sda3 
e2fsck 1.42.9 (28-Dec-2013) 
e2fsck: Bad magic number in super-block while trying to open /dev/sda3 

The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: 
      e2fsck -b 8193 <device>

You have run fsck on your LVM not on /dev/sda3. /dev/sda3 is part of LVM. Use any one of the following command to find out info about your vol:

pvs
pvscan
pvdisplay

If it is called /dev/mapper/pve-root run:

fsck -y /dev/mapper/pve-root

Hi,

This is what I have running those 3…

[liveuser@localhost —]$ pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda3  pve  lvm2 a--  446.88g 15.83g

[liveuser@localhost —]$ pvscan
  PV /dev/sda3   VG pve   lvm2 [446.88 GiB / 15.83 GiB free]
  Total: 1 [446.88 GiB] / in use: 1 [446.88 GiB] / in no VG: 0 [0   ]

[liveuser@localhost —]$ pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               pve
  PV Size               446.88 GiB / not usable 4.82 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              114400
  Free PE               4052
  Allocated PE          110348
  PV UUID               llHl00-31Am-wEPo-NLO9-eve3-3ehb-xj2yvw

When you run in rescue mode run df and mount and make sure /dev/sda3 is not mounted.

df
mount

Running mount and df doesn’t show that /dev/sda3

Now I am getting this

[liveuser@localhost —]$ sudo e2fsck -y /dev/sda3
e2fsck 1.42.9 (28-Dec-2013)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks…
e2fsck: Bad magic number in super-block while trying to open /dev/sda3

The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193